:root {
  --bg: #0a0a0b;
  --bg-elev: #131316;
  --hover: rgba(255, 255, 255, 0.04);
  --text: #e5e5e7;
  --text-dim: #86868b;
  --text-faint: #5a5a60;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --accent: #ffffff;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --radius: 4px;
  --topbar-h: 60px;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 400;
  line-height: 1.5;
  min-height: 100vh;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ===== 顶栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--accent);
  color: #000;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
}

.brand-name {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  justify-content: center;
}

.filter-btn {
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-dim);
  border-radius: 999px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--text);
  background: var(--hover);
}

.filter-btn.active {
  color: #000;
  background: var(--accent);
  font-weight: 500;
}

.svc-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.svc-btn {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.svc-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.svc-btn.active {
  color: #000;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 500;
}

/* ===== 主区 ===== */
main {
  padding: 20px 24px 60px;
  max-width: 1600px;
  margin: 0 auto;
}

/* ===== 空状态 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px;
  max-width: 520px;
  margin: 0 auto;
}

.empty-icon {
  color: var(--text-faint);
  margin-bottom: 24px;
}

.empty-title {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.2px;
  margin-bottom: 12px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 28px;
}

.empty-action {
  padding: 11px 28px;
  font-size: 14px;
  font-weight: 500;
  color: #000;
  background: var(--accent);
  border-radius: 999px;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.empty-action:hover {
  transform: translateY(-1px);
  opacity: 0.92;
}

/* ===== 画廊 瀑布流 ===== */
.gallery {
  column-count: 4;
  column-gap: 14px;
}

@media (max-width: 1200px) {
  .gallery { column-count: 3; }
}
@media (max-width: 860px) {
  .gallery { column-count: 2; }
}
@media (max-width: 768px) {
  .svc-filters { gap: 2px; }
  .svc-btn { padding: 6px 10px; font-size: 11px; }
}
@media (max-width: 560px) {
  .gallery { column-count: 1; }
  main { padding: 16px 14px 50px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .brand-name { display: none; }
  .filters { justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .filter-btn { padding: 6px 12px; font-size: 12px; }
}

.card {
  break-inside: avoid;
  margin-bottom: 14px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  cursor: pointer;
  transition: transform 0.3s var(--ease);
  contain: layout style paint;
}

.card:hover {
  transform: translateY(-4px);
}

.card-img-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(135deg, #161618, #0f0f11);
}

.card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}

.card-img.loaded {
  opacity: 1;
}

.card-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0) 55%);
  opacity: 0;
  transition: opacity 0.3s var(--ease);
  pointer-events: none;
}

.card:hover .card-overlay {
  opacity: 1;
}

.card-prompt {
  font-size: 12.5px;
  line-height: 1.5;
  color: #f0f0f2;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.card-user {
  font-size: 11.5px;
  color: var(--text-dim);
}

/* ===== 加载 ===== */
.loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: var(--text-dim);
  font-size: 13px;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.sentinel {
  height: 1px;
}

.hidden {
  display: none !important;
}

/* ===== Lightbox ===== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in 0.3s var(--ease);
}

.lightbox-content {
  position: relative;
  z-index: 1;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: zoom-in 0.35s var(--ease);
}

.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 90vh;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.lightbox-caption {
  margin-top: 16px;
  max-width: 720px;
  text-align: center;
}

.lightbox-prompt {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 10px;
}

.lightbox-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
}

.lightbox-user {
  color: var(--text-dim);
}

.lightbox-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background 0.2s var(--ease);
}

.lightbox-download:hover {
  background: var(--hover);
}

.lightbox-close {
  position: absolute;
  top: -48px;
  right: -8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  border-radius: 50%;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.lightbox-close:hover {
  color: var(--text);
  background: var(--hover);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zoom-in {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 11px 22px;
  font-size: 13px;
  color: var(--text);
  background: rgba(30, 30, 34, 0.95);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: toast-in 0.3s var(--ease);
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
