:root {
  --c-deep:    #291f6b;
  --c-violet:  #602287;
  --c-magenta: #a42398;
  --c-rose:    #c22467;
  --c-red:     #de3026;

  --ink:       #1c1730;
  --paper:     #faf8f5;
  --card:      #ffffff;
  --muted:     #6c6582;
  --line:      rgba(41, 31, 107, 0.12);

  --radius:    14px;
  --shadow-sm: 0 2px 6px rgba(28, 23, 48, 0.06), 0 1px 2px rgba(28, 23, 48, 0.04);
  --shadow-md: 0 12px 28px rgba(28, 23, 48, 0.16), 0 4px 10px rgba(28, 23, 48, 0.08);

  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--c-deep) 0%, var(--c-violet) 45%, var(--c-magenta) 75%, var(--c-rose) 100%);
  color: #fff;
  padding: 56px 0 40px;
}
.site-header h1 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.site-header .lede {
  margin: 0 0 20px;
  opacity: 0.9;
  font-size: 1rem;
  max-width: 70ch;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}
.badge-A { background: var(--c-deep); }
.badge-B { background: var(--c-magenta); }
.badge-C { background: var(--c-red); }

/* Sections */
.gallery-section { padding: 56px 0 32px; }
.section-head { margin-bottom: 28px; }
.section-head h2 {
  margin: 0 0 6px;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--c-deep);
}
.section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}
.section-head em { font-style: italic; color: var(--ink); }

.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent);
  margin: 24px 0;
}

/* Set groups */
.set-groups {
  display: flex;
  flex-direction: column;
  gap: 40px;
}
.set-group h3 {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}
.set-group h3 .badge { font-size: 0.72rem; }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

/* Card */
.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card:focus-visible {
  outline: 2px solid var(--c-magenta);
  outline-offset: 2px;
}

.card-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #efeaf2;
  overflow: hidden;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.card:hover .card-thumb img { transform: scale(1.03); }

.card-thumb .thumb-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}
.card-thumb .thumb-id {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.card-thumb .thumb-missing {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.85rem;
  background: repeating-linear-gradient(45deg, #f1ecf4 0 10px, #ede6f1 10px 20px);
}

.card-body {
  padding: 12px 14px 14px;
}
.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--ink);
}
.card-prompt {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Footer */
.site-footer {
  padding: 32px 0 48px;
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer code {
  font-family: var(--font-mono);
  background: rgba(41, 31, 107, 0.07);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(20, 14, 40, 0.88);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
}
.lightbox.is-open { display: flex; }

.lb-stage {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 1180px;
  max-height: 90vh;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4);
}
.lb-figure {
  margin: 0;
  background: #0f0a1d;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}
.lb-figure img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.lb-meta {
  padding: 28px 26px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.lb-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.lb-version {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.lb-meta h3 {
  margin: 0 0 18px;
  font-size: 1.15rem;
  color: var(--c-deep);
  font-weight: 700;
}
.lb-prompt-wrap label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
}
.lb-prompt-wrap textarea {
  width: 100%;
  min-height: 260px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink);
  background: #faf7fb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
}
.btn-copy {
  margin-top: 12px;
  background: var(--c-deep);
  color: #fff;
  border: 0;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.btn-copy:hover { background: var(--c-violet); }
.copy-feedback {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.82rem;
  color: var(--c-magenta);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.copy-feedback.is-visible { opacity: 1; }

/* Lightbox controls */
.lb-close,
.lb-nav {
  position: fixed;
  background: rgba(255, 255, 255, 0.95);
  color: var(--c-deep);
  border: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  z-index: 1001;
}
.lb-close { top: 18px; right: 18px; font-size: 1.6rem; }
.lb-prev  { top: 50%; left: 18px;  transform: translateY(-50%); }
.lb-next  { top: 50%; right: 18px; transform: translateY(-50%); }
.lb-close:hover,
.lb-nav:hover { background: #fff; color: var(--c-magenta); }

/* Responsive */
@media (max-width: 880px) {
  .lb-stage {
    grid-template-columns: 1fr;
    max-height: 92vh;
  }
  .lb-figure { max-height: 50vh; }
  .lb-figure img { max-height: 50vh; }
  .lb-meta { padding: 20px; }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
}
@media (max-width: 520px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .card-body { padding: 10px 12px 12px; }
  .card-title { font-size: 0.88rem; }
  .card-prompt { font-size: 0.76rem; -webkit-line-clamp: 2; }
  .site-header { padding: 40px 0 28px; }
}
