:root {
  --bg: #08080a;
  --bg-elev: #111114;
  --bg-card: #141418;
  --bg-hover: #1b1b21;
  --glass: rgba(17, 17, 21, 0.84);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f4f6;
  --text-muted: #9898a6;
  --text-dim: #656573;
  --accent: #ffffff;
  --accent-ink: #09090b;
  --blue: #5aa9ff;
  --danger: #f87171;
  --gold: #fbbf24;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.65);
}

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

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 38% at 50% -10%, rgba(255, 255, 255, 0.055), transparent 70%),
    radial-gradient(35% 30% at 85% 15%, rgba(90, 169, 255, 0.04), transparent 70%);
  z-index: 0;
}

.hidden { display: none !important; }

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  background: rgba(8, 8, 10, 0.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -0.02em;
  color: var(--text);
  user-select: none;
  flex-shrink: 0;
}

.brand-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}

.pill-ver {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border-strong);
  color: #e4e4ec;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.tab-count {
  font-size: 11px;
  color: var(--text-dim);
}
.tab-btn.active .tab-count { color: #d4d4df; }

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-ico {
  position: absolute;
  left: 11px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-wrap input {
  width: 210px;
  padding: 7px 12px 7px 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.16s ease, width 0.2s ease, background 0.16s ease;
}

.search-wrap input:focus {
  width: 260px;
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.07);
}

.ratelimit-pill {
  font-size: 12px;
  color: var(--text-muted);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: rgba(255, 255, 255, 0.08); }

/* Main Canvas */
.main-canvas {
  position: relative;
  z-index: 1;
  max-width: 1640px;
  margin: 0 auto;
  padding: 20px 22px 230px;
}

/* Failed Banners */
.failed-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.failed-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--radius-md);
  background: rgba(248, 113, 113, 0.09);
  border: 1px solid rgba(248, 113, 113, 0.28);
  color: #fecaca;
  font-size: 13px;
}

.failed-banner-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.failed-banner-prompt {
  color: #fca5a5;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Running Section */
.running-section {
  margin-bottom: 24px;
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 10px var(--blue);
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.82); }
}

.running-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.running-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 16px;
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.running-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.045) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 1.8s infinite linear;
  pointer-events: none;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.running-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e2ee;
}

.badge-soft.edit {
  background: rgba(90, 169, 255, 0.16);
  color: #93c5fd;
}

.running-timer {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-muted);
}

.running-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0;
}

.spinner {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

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

.running-prompt {
  font-size: 13px;
  color: #d4d4df;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.running-meta {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-dim);
}

/* Empty State */
.empty-state {
  max-width: 960px;
  margin: 36px auto 20px;
  text-align: center;
}

.empty-hero h1 {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  letter-spacing: -0.03em;
  background: linear-gradient(180deg, #ffffff 0%, #9898a8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}

.empty-hero p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.65;
  max-width: 660px;
  margin: 0 auto 30px;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  text-align: left;
}

.starter-card {
  padding: 16px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.18s ease;
}

.starter-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.starter-tag {
  font-size: 11px;
  color: var(--blue);
  font-weight: 600;
  margin-bottom: 6px;
}

.starter-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
}

.starter-prompt {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Masonry Gallery */
.gallery-grid {
  column-count: 4;
  column-gap: 14px;
}

@media (max-width: 1320px) { .gallery-grid { column-count: 3; } }
@media (max-width: 900px) { .gallery-grid { column-count: 2; } }
@media (max-width: 560px) { .gallery-grid { column-count: 1; } }

.art-card {
  position: relative;
  break-inside: avoid;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.art-card:hover {
  border-color: var(--border-strong);
}

.art-card img {
  display: block;
  width: 100%;
  height: auto;
  background: #101014;
  transition: transform 0.35s ease;
}

.art-card:hover img {
  transform: scale(1.018);
}

.art-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.art-pill {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #f0f0f7;
}

.art-pill.edit {
  background: rgba(24, 58, 108, 0.78);
  border-color: rgba(90, 169, 255, 0.38);
  color: #bfdbfe;
}

.art-fav-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 12, 0.72);
  color: var(--gold);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.art-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 14px;
  background: linear-gradient(180deg, transparent 42%, rgba(6, 6, 10, 0.88) 100%);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.art-card:hover .art-overlay,
.art-card:focus-within .art-overlay {
  opacity: 1;
}

.art-prompt {
  font-size: 12.5px;
  color: #f4f4f8;
  line-height: 1.45;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.art-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.art-actions-left, .art-actions-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mini-act-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(15, 15, 20, 0.82);
  backdrop-filter: blur(8px);
  color: #f4f4f8;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.mini-act-btn:hover {
  background: #ffffff;
  color: #09090b;
  border-color: #ffffff;
}

.mini-act-btn.fav-active {
  color: var(--gold);
  border-color: rgba(251, 191, 36, 0.45);
}

/* Floating Composer Dock */
.composer-dock-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  padding: 0 16px max(16px, env(safe-area-inset-bottom));
  pointer-events: none;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 8, 10, 0.92) 60%);
}

.composer-dock {
  pointer-events: auto;
  max-width: 880px;
  margin: 0 auto;
  background: var(--glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  padding: 12px 14px 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.composer-dock:focus-within {
  border-color: rgba(255, 255, 255, 0.3);
}

.edit-quick-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.edit-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #bfdbfe;
}

.dot-blue {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.quick-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-btn {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip-btn:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
}

.ref-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
}

.ref-thumb-item {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
  background: #14141a;
}

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

.ref-idx {
  position: absolute;
  left: 4px;
  bottom: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
}

.ref-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.78);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ref-remove:hover { background: var(--danger); }

.ref-add-slot {
  width: 58px;
  height: 58px;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s ease;
}
.ref-add-slot:hover { border-color: #fff; color: #fff; background: rgba(255, 255, 255, 0.06); }

.composer-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.composer-input-row textarea {
  flex: 1;
  min-height: 28px;
  max-height: 140px;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  padding: 4px 2px;
  outline: none;
  font-family: inherit;
}

.composer-input-row textarea::placeholder {
  color: var(--text-dim);
}

.generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.14s ease, opacity 0.14s ease;
}

.generate-btn:hover { opacity: 0.92; transform: translateY(-1px); }
.generate-btn:active { transform: translateY(0); }
.generate-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #dcdce6;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tool-btn:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.tool-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.tool-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.mini-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--blue);
  color: #061322;
}

.seg-group {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 2px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.seg-btn {
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 550;
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-btn:hover { color: var(--text); }
.seg-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.ratio-preview-ico {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
}

/* Popovers */
.popover-anchor { position: relative; }

.popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  min-width: 260px;
  padding: 12px;
  border-radius: var(--radius-md);
  background: #15151a;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  z-index: 60;
}

.preset-popover {
  left: auto;
  right: 0;
  width: 310px;
}

.ratio-popover { width: 340px; }
.count-popover { width: 240px; }

.popover-title {
  font-size: 12px;
  font-weight: 650;
  color: #e4e4ee;
  margin-bottom: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.popover-hint {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-dim);
}

.popover-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin: 10px 0 7px;
}

.model-option {
  width: 100%;
  text-align: left;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 4px;
  transition: all 0.14s ease;
}

.model-option:hover { background: rgba(255, 255, 255, 0.05); }
.model-option.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.opt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 3px;
}

.opt-tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(90, 169, 255, 0.18);
  color: #93c5fd;
}

.opt-tag.muted {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

.opt-desc {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}

.ratio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.ratio-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 4px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.ratio-opt:hover { border-color: var(--border-strong); color: #fff; }
.ratio-opt.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
}

.ratio-box-wrap {
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ratio-box {
  border: 1.6px solid currentColor;
  border-radius: 2px;
}

.count-pills {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.count-pill {
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.count-pill:hover { border-color: var(--border-strong); color: #fff; }
.count-pill.active {
  background: #fff;
  color: #09090b;
  border-color: #fff;
}

.preset-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 270px;
  overflow-y: auto;
}

.preset-item {
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  cursor: pointer;
}

.preset-item:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--border-strong); }
.preset-item strong { display: block; font-size: 12px; margin-bottom: 2px; }
.preset-item span { display: block; font-size: 11px; color: var(--text-muted); }

/* Drop Overlay */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(8, 8, 12, 0.84);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.drop-box {
  padding: 46px 56px;
  border-radius: var(--radius-xl);
  border: 2px dashed rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
  color: #fff;
}

.drop-title { font-size: 20px; font-weight: 650; margin-top: 12px; }
.drop-sub { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* Auth Gate */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(6, 6, 8, 0.94);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 390px;
  padding: 30px;
  border-radius: var(--radius-xl);
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.auth-brand { justify-content: center; font-size: 20px; margin-bottom: 10px; }
.auth-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-form input {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 14px;
  outline: none;
}

.auth-form input:focus { border-color: #fff; }
.auth-error { margin-top: 10px; font-size: 12.5px; color: var(--danger); }

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 12px;
  border: none;
  background: #fff;
  color: #09090b;
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary:hover { opacity: 0.92; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  flex: 1;
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.1); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.08);
  color: #fca5a5;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.16); }
.full { width: 100%; }

.text-btn {
  background: transparent;
  border: none;
  color: var(--blue);
  font-size: 12px;
  cursor: pointer;
}
.text-btn:hover { text-decoration: underline; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 6, 0.9);
  backdrop-filter: blur(14px);
}

.lb-shell {
  position: relative;
  z-index: 1;
  width: min(1360px, 96vw);
  height: min(90vh, 920px);
  display: grid;
  grid-template-columns: 1fr 340px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(15, 15, 20, 0.8);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-stage {
  position: relative;
  background: #060608;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 24px 56px 58px;
}

.lb-media-wrap {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb-img {
  max-width: 100%;
  max-height: calc(min(90vh, 920px) - 96px);
  border-radius: 10px;
  object-fit: contain;
  display: block;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(18, 18, 22, 0.78);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 4;
}
.lb-nav.prev { left: 12px; }
.lb-nav.next { right: 12px; }
.lb-nav:hover { background: rgba(255, 255, 255, 0.16); }

/* Before/After Split Compare */
.compare-wrap {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: calc(min(90vh, 920px) - 96px);
  border-radius: 10px;
  overflow: hidden;
  user-select: none;
}

.compare-img.after {
  display: block;
  max-width: 100%;
  max-height: calc(min(90vh, 920px) - 96px);
  object-fit: contain;
}

.compare-before-clip {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
}

.compare-img.before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: none;
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-line {
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.compare-knob {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #fff;
  color: #09090b;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.compare-tag {
  position: absolute;
  top: 12px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  pointer-events: none;
}
.compare-tag.left { left: 12px; }
.compare-tag.right { right: 12px; }

.compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 3;
}

.lb-compare-bar {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(18, 18, 24, 0.86);
  border: 1px solid var(--border-strong);
  backdrop-filter: blur(10px);
}

.pill-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
}
.pill-btn.active { background: #fff; color: #09090b; }

.lb-ref-picker { display: flex; align-items: center; gap: 4px; }
.lb-ref-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  background: none;
}
.lb-ref-dot.active { border-color: var(--blue); }
.lb-ref-dot img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Lightbox Sidebar */
.lb-sidebar {
  padding: 20px;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.lb-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.lb-label {
  font-size: 11.5px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.lb-label-row .lb-label { margin-bottom: 0; }

.lb-prompt {
  font-size: 13.5px;
  line-height: 1.55;
  color: #ececf4;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  max-height: 150px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.lb-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meta-cell {
  padding: 8px 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
}

.meta-k { font-size: 10.5px; color: var(--text-dim); margin-bottom: 2px; }
.meta-v { font-size: 12.5px; color: #ececf4; font-weight: 550; word-break: break-all; }

.lb-refs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lb-ref-thumb {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  cursor: pointer;
}
.lb-ref-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lb-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.lb-action-row {
  display: flex;
  gap: 8px;
}

/* Toast */
.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(24, 24, 30, 0.95);
  border: 1px solid var(--border-strong);
  color: #fff;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
}

@media (max-width: 900px) {
  .topbar { padding: 10px 14px; flex-wrap: wrap; }
  .search-wrap input { width: 150px; }
  .search-wrap input:focus { width: 190px; }
  .lb-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 54% 46%;
    width: 96vw;
    height: 92vh;
  }
  .lb-stage { padding: 14px 40px 52px; }
  .lb-sidebar { border-left: none; border-top: 1px solid var(--border); }
  .ratio-popover { width: 290px; }
}
