:root {
  --bg: #0b0b0f;
  --bg-soft: #15151c;
  --fg: #f2f2f5;
  --muted: #8b8b97;
  --accent: #c4a3ff;
  --border: #26262f;
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, #1c1430 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 10%, #0f2030 0%, transparent 55%),
    var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------- header ---------- */
.site-header {
  text-align: center;
  padding: 4rem 1.5rem 2.5rem;
}
.logo {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0;
  background: linear-gradient(120deg, #fff 0%, var(--accent) 60%, #7ad7ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo span { font-weight: 300; }
.tagline { color: var(--muted); margin: 0.6rem 0 0; font-size: 1rem; }
.count { color: var(--accent); margin: 0.4rem 0 0; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; }

/* ---------- masonry grid ---------- */
.grid {
  column-count: 4;
  column-gap: 14px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 14px 4rem;
}
@media (max-width: 1200px) { .grid { column-count: 3; } }
@media (max-width: 800px)  { .grid { column-count: 2; } }
@media (max-width: 480px)  { .grid { column-count: 1; } }

.card {
  break-inside: avoid;
  margin-bottom: 14px;
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  cursor: zoom-in;
  opacity: 0;
  transform: translateY(8px);
  animation: rise 0.5s ease forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }

.card img { display: block; width: 100%; height: auto; }

.card .cap {
  padding: 0.85rem 0.95rem 0.95rem;
  border-top: 1px solid var(--border);
}
.card .cap-prompt {
  margin: 0 0 0.6rem;
  font-size: 0.83rem;
  line-height: 1.4;
  color: #dcdce4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .cap-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.card .cap-time { color: var(--muted); }
.card .cap-tokens {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

/* ---------- empty state ---------- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 4rem 1.5rem 6rem;
}
.empty code {
  display: inline-block;
  margin: 0.8rem 0;
  padding: 0.5rem 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--accent);
  font-size: 0.95rem;
}
.empty .muted { font-size: 0.85rem; }

/* ---------- footer ---------- */
.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 2rem 1.5rem 3rem;
  border-top: 1px solid var(--border);
}

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 2rem;
}
.lb-figure { margin: 0; max-width: min(92vw, 1100px); max-height: 92vh; display: flex; flex-direction: column; gap: 0.8rem; }
.lb-figure img { max-width: 100%; max-height: 78vh; object-fit: contain; border-radius: 10px; margin: 0 auto; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.lb-figure figcaption { color: #d7d7df; font-size: 0.9rem; line-height: 1.5; text-align: center; max-width: 800px; margin: 0 auto; }
.lb-figure figcaption .sub { display: block; color: var(--muted); font-size: 0.78rem; margin-top: 0.4rem; }

.lb-close, .lb-nav {
  position: fixed;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, 0.2); }
.lb-close { top: 1.2rem; right: 1.2rem; width: 44px; height: 44px; font-size: 1.1rem; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 52px; height: 52px; font-size: 1.8rem; }
.lb-prev { left: 1.2rem; }
.lb-next { right: 1.2rem; }
@media (max-width: 600px) { .lb-nav { width: 40px; height: 40px; } }

[hidden] { display: none !important; }
