:root {
  --bg-color: #1a1a1e;
  --card-bg: rgba(255, 255, 255, 0.08);
  --text-color: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-dim: #86868b;
  --primary-color: #0a84ff;
  --ctrl-bg: rgba(255, 255, 255, 0.1);
  --ctrl-border: rgba(255, 255, 255, 0.15);
  --ctrl-hover: rgba(255, 255, 255, 0.16);
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-blur: 40px;
}

body.light-mode {
  --bg-color: #f2f2f7;
  --card-bg: rgba(255, 255, 255, 0.7);
  --text-color: #1d1d1f;
  --text-muted: #6e6e73;
  --text-dim: #86868b;
  --ctrl-bg: rgba(255, 255, 255, 0.6);
  --ctrl-border: rgba(0, 0, 0, 0.08);
  --ctrl-hover: rgba(255, 255, 255, 0.8);
  --border-color: rgba(0, 0, 0, 0.08);
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(0, 0, 0, 0.06);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1600px; margin: 0 auto; padding: 20px; }

/* Header */
.header { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--border-color); }
.header-top { display: flex; align-items: center; gap: 12px; }

.brand {
  font-size: 1.5rem; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; transition: opacity 0.2s; white-space: nowrap; letter-spacing: -0.02em;
}
.brand:hover { opacity: 0.8; }

.header-controls { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.search-wrapper { position: relative; display: flex; align-items: center; flex: 1; max-width: 240px; }

.inline-search {
  width: 100%; height: 32px; padding: 0 32px 0 10px; border-radius: 8px;
  background: var(--ctrl-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-color); border: 1px solid var(--ctrl-border); font-size: 0.85rem; outline: none; transition: all 0.2s;
}
.search-icon { position: absolute; right: 8px; color: var(--text-dim); font-size: 0.8rem; pointer-events: none; }
.inline-search:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2); }
.inline-search::placeholder { color: var(--text-dim); }
.inline-search.searching { border-color: #ff9f0a; }

.inline-select {
  height: 32px; padding: 0 8px; border: 1px solid var(--ctrl-border);
  background: var(--ctrl-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-muted); font-size: 0.85rem; border-radius: 8px; cursor: pointer; outline: none; transition: all 0.2s;
}
.inline-select:hover { color: var(--text-color); background: var(--ctrl-hover); }

.action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--ctrl-bg); backdrop-filter: blur(var(--glass-blur)); -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-color); border: 1px solid var(--ctrl-border);
  cursor: pointer; transition: all 0.2s; font-size: 0.9rem; flex-shrink: 0;
}
.action-btn:hover { background: var(--ctrl-hover); }
.menu-wrapper { margin-left: auto; display: flex; align-items: center; gap: 6px; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 40px; }
@media (max-width: 768px) { .gallery { grid-template-columns: 1fr; gap: 12px; } }
.card.featured { grid-column: span 2; grid-row: span 2; }
@media (max-width: 770px) { .card.featured { grid-column: auto; grid-row: auto; } }

/* Card */
.card {
  position: relative; background: var(--card-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border); border-radius: 16px;
  overflow: hidden; aspect-ratio: 16 / 9; cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.card:hover { transform: scale(1.02); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }

.card-img, .card-video, .card-thumb {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity 0.4s ease;
}
.card-img.loaded, .card-video.loaded, .card-thumb.loaded { opacity: 1; }

/* 视频占位符 */
.video-placeholder {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  display: flex; align-items: center; justify-content: center;
}
.video-placeholder::after {
  content: ''; width: 50px; height: 50px;
  background: rgba(255,255,255,0.15); border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  box-shadow: 0 0 30px rgba(255,255,255,0.1);
}
.video-placeholder::before {
  content: ''; position: absolute;
  border-left: 18px solid white; border-top: 11px solid transparent;
  border-bottom: 11px solid transparent; margin-left: 6px;
}

.card-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 50%); pointer-events: none; }
.card-content { position: absolute; bottom: 0; left: 0; right: 0; padding: 16px; z-index: 2; }
.card-title { font-size: 0.95rem; font-weight: 500; color: white; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.card-date { font-size: 0.75rem; color: rgba(255, 255, 255, 0.7); margin-top: 4px; }

.card-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: white; padding: 4px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 500; z-index: 3;
}

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.95);
  z-index: 2000; display: none; flex-direction: column; align-items: center;
}
.lightbox.show { display: flex; }

.lightbox-toolbar {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px;
  background: rgba(40, 40, 40, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15); padding: 6px 12px; border-radius: 20px; z-index: 2002;
}

.zoom-btn {
  width: 32px; height: 32px; border: none; background: transparent;
  color: white; font-size: 0.9rem; cursor: pointer; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.zoom-btn:hover { background: rgba(255, 255, 255, 0.15); }
.zoom-level { color: white; font-size: 0.8rem; min-width: 44px; text-align: center; font-weight: 500; }

.lightbox-content {
  flex: 1; width: 100%; display: flex; justify-content: center; align-items: center;
  overflow: hidden; cursor: grab; padding: 60px 20px 0;
}
.lightbox-content:active { cursor: grabbing; }

.lb-spinner {
  position: absolute; display: none; align-items: center; justify-content: center;
}
.lb-spinner .spinner {
  width: 36px; height: 36px; border: 3px solid rgba(255,255,255,0.2);
  border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite;
}

#lightbox-media {
  max-width: 55vw; max-height: 65vh; object-fit: contain;
  border-radius: 12px; user-select: none;
  -webkit-user-drag: none; pointer-events: none;
}

.lightbox-video {
  max-width: 55vw; max-height: 65vh; object-fit: contain;
  border-radius: 12px; outline: none; background: black; user-select: none;
}

.close-lightbox {
  position: fixed; top: 16px; right: 20px;
  background: rgba(40, 40, 40, 0.8); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15); color: white; font-size: 1.2rem;
  cursor: pointer; z-index: 2002; width: 36px; height: 36px; border-radius: 50%;
  transition: background 0.2s; display: flex; align-items: center; justify-content: center;
}
.close-lightbox:hover { background: rgba(255, 255, 255, 0.2); }

/* Lightbox Info */
.lightbox-info {
  width: 100%; padding: 16px 40px 24px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
}

#lb-desc {
  font-size: 0.95rem; color: rgba(255,255,255,0.8); margin-bottom: 12px;
  max-width: 600px; line-height: 1.6;
}
#lb-desc:empty { display: none; }

#lb-title { font-size: 1.1rem; font-weight: 500; margin-bottom: 6px; color: white; }

.lb-meta {
  font-size: 0.8rem; color: rgba(255,255,255,0.6); margin-bottom: 6px;
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.lb-meta span { display: inline-flex; align-items: center; }
.lb-meta span::after { content: '·'; margin-left: 8px; opacity: 0.4; }
.lb-meta span:last-child::after { display: none; }
.lb-meta span:empty { display: none; }

.dl-btn {
  text-decoration: none; padding: 8px 20px; border-radius: 20px; font-weight: 500;
  transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
  background: var(--primary-color); color: white; font-size: 0.85rem;
}
.dl-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 40px 0; flex-wrap: wrap; }

.page-btn {
  background: var(--ctrl-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  color: var(--text-muted); border: 1px solid var(--ctrl-border);
  min-width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
  transition: all 0.2s; font-size: 0.85rem;
}
.page-btn:hover { background: var(--ctrl-hover); }
.page-btn.active { background: var(--primary-color); color: white; border-color: var(--primary-color); }
.page-dots { color: var(--text-dim); display: flex; align-items: center; padding: 0 4px; }

/* Loading */
.loading-overlay {
  position: fixed; inset: 0; background: var(--bg-color);
  z-index: 3000; display: none; justify-content: center; align-items: center;
}
.loading-overlay.show { display: flex; }
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--border-color);
  border-top-color: var(--primary-color); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.footer { text-align: center; color: var(--text-dim); font-size: 0.8rem; padding: 24px 0; border-top: 1px solid var(--border-color); }
.footer-link { color: var(--primary-color); text-decoration: none; transition: opacity 0.2s; }
.footer-link:hover { opacity: 0.8; }

/* Mobile Filter */
.mobile-menu-btn { display: none; }

.mobile-filter-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4);
  z-index: 1500; opacity: 0; visibility: hidden; transition: all 0.3s ease;
}
.mobile-filter-overlay.show { opacity: 1; visibility: visible; }

.mobile-filter-panel {
  position: fixed; top: 0; right: 0; width: 280px; max-width: 85vw; height: 100vh;
  background: rgba(30, 30, 30, 0.95); backdrop-filter: blur(40px); -webkit-backdrop-filter: blur(40px);
  border-left: 1px solid rgba(255,255,255,0.1); z-index: 1501;
  transform: translateX(100%); transition: transform 0.3s ease;
  display: flex; flex-direction: column;
}
.mobile-filter-panel.show { transform: translateX(0); }

.mobile-filter-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 1rem; font-weight: 600; color: white;
}

.mobile-filter-close {
  width: 32px; height: 32px; border: none; background: transparent;
  color: white; font-size: 1.1rem; cursor: pointer; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; transition: background 0.2s;
}
.mobile-filter-close:hover { background: rgba(255,255,255,0.1); }

.mobile-filter-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.mobile-filter-body .search-wrapper { max-width: none; }
.mobile-filter-body .inline-search { width: 100%; height: 40px; font-size: 0.95rem; }

.mobile-select {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 8px;
  background: rgba(255,255,255,0.1); color: white;
  border: 1px solid rgba(255,255,255,0.15); font-size: 0.9rem;
  cursor: pointer; outline: none; transition: border-color 0.2s;
}
.mobile-select:focus { border-color: var(--primary-color); }
.mobile-select option { background: #1e1e1e; color: white; }

/* Responsive */
@media (max-width: 850px) {
  .brand { font-size: 1.2rem; }
  .header-controls { display: none; }
  .mobile-menu-btn { display: flex !important; }
  #lightbox-media, .lightbox-video { max-width: 92vw; max-height: 55vh; }
  .lightbox-info { padding: 12px 20px 20px; }
  #lb-title { font-size: 1rem; }
}

@media (max-width: 480px) {
  .brand { font-size: 1.1rem; gap: 8px; }
  .action-btn { width: 28px; height: 28px; font-size: 0.8rem; }
}
