:root {
  --bg: #101014;
  --sidebar-bg: #131317;
  --topbar-bg: #131317;
  --card-bg: #1a1a20;
  --border: #262630;
  --text: #f2f2f5;
  --text-dim: #9a9aa6;
  --text-dimmer: #6c6c78;
  --accent: #a855f7;
  --accent-2: #6366f1;
  --accent-soft: rgba(168, 85, 247, 0.15);
  --radius: 12px;
  --sidebar-w: 92px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Inter", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  z-index: 20;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 8px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.logo:hover { opacity: 0.85; }
.logo:active { transform: scale(0.94); }
.logo.pop { animation: logoPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }

@keyframes logoPop {
  0% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(0.88) rotate(-5deg); }
  70% { transform: scale(1.1) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}
.logo-mark { display: flex; align-items: center; }
.logo-text {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.2px;
  background: linear-gradient(90deg, #d8b4fe, #a855f7 60%, #6366f1);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 11px 4px;
  border-radius: 12px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.nav-item .icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  transition: transform 0.1s ease;
}

.nav-item:hover {
  background: #1c1c23;
  color: var(--text);
}

.nav-item:active {
  transform: scale(0.95);
}

.nav-item.active {
  background: var(--accent-soft);
  color: #d8b4fe;
}

.nav-item.pop .icon {
  animation: navIconPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes navIconPop {
  0% { transform: scale(1); }
  40% { transform: scale(0.8); }
  70% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

.nav-item-cta {
  margin-top: 4px;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.nav-item-cta:hover {
  background: linear-gradient(90deg, #b866ff, #757dfa);
  color: #fff;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 15;
}

/* Main column */
.main-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--topbar-h);
  flex-shrink: 0;
  padding: 0 24px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 25;
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.hamburger svg { width: 22px; height: 22px; }
.hamburger:hover { background: #1c1c23; }

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 640px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-dimmer);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px 10px 40px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search-input::placeholder { color: var(--text-dimmer); }

.search-input:focus {
  border-color: var(--accent);
  background: #202028;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.unlock-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, #a855f7, #6366f1);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: opacity 0.15s ease;
  animation: unlock-btn-pulse 4s ease-in-out infinite;
}
.unlock-btn:hover { opacity: 0.95; }
.unlock-btn:active { transform: scale(0.95); }

.unlock-btn-content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.unlock-btn-shine {
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.65), transparent);
  transform: skewX(-20deg);
  pointer-events: none;
}

.unlock-btn:hover .unlock-btn-shine {
  animation: unlock-btn-shine 0.85s ease forwards;
}

@keyframes unlock-btn-shine {
  from { left: -60%; }
  to { left: 130%; }
}

@keyframes unlock-btn-pulse {
  0%, 50%, 100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
  }
  62%, 88% {
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.22), 0 0 12px 3px rgba(168, 85, 247, 0.4);
  }
}

.unlock-btn-wrap {
  position: relative;
}

.unlock-btn-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: #1c1c23;
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 16px rgba(168, 85, 247, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 50;
  pointer-events: none;
}

.unlock-btn-tooltip.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.unlock-btn-tooltip-title {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.unlock-btn-tooltip-body {
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: #1c1c23; color: var(--text); }

.avatar-btn {
  background: none;
  border: none;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
}

.avatar-btn.pop {
  animation: avatarPop 0.35s ease;
}

@keyframes avatarPop {
  0% { transform: scale(1); }
  35% { transform: scale(0.92); }
  65% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

.account-menu-wrap {
  position: relative;
}

.account-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 260px;
  background: #1a1a20;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 8px;
  display: flex;
  flex-direction: column;
  z-index: 100;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.account-menu.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.account-menu-usage {
  padding: 10px 12px 14px;
}

.usage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 10px;
}

.usage-row svg {
  width: 15px;
  height: 15px;
  color: var(--accent-2);
  flex-shrink: 0;
}

.usage-bar {
  height: 6px;
  border-radius: 999px;
  background: #2a2a33;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-2), #38bdf8);
}

.account-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
}

.account-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  transition: background 0.15s ease;
}

.account-menu-item svg {
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.account-menu-item:hover {
  background: #232329;
}

.account-menu-item-value {
  margin-left: auto;
  color: var(--text-dimmer);
  font-size: 13px;
  font-weight: 500;
}

.avatar {
  display: inline-block;
  border-radius: 50%;
  background: linear-gradient(135deg, #f472b6, #a855f7 50%, #6366f1);
}
.avatar-lg { width: 34px; height: 34px; }
.avatar-sm { width: 24px; height: 24px; }

/* Content */
.content {
  padding: 28px 32px 60px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-head h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.browse-link {
  font-size: 14px;
  color: #a5b4fc;
  font-weight: 500;
}
.browse-link:hover { text-decoration: underline; }

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

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-3px);
  border-color: #3a3a48;
}

.thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  overflow: hidden;
}

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

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #fff;
  background: rgba(168, 85, 247, 0.92);
  text-transform: uppercase;
}

.thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 25%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.8) 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

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

.thumb-likes {
  align-self: flex-end;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.thumb-likes svg {
  width: 16px;
  height: 16px;
}

.thumb-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.thumb-title {
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.thumb-creator {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.thumb-creator .creator-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

/* Upgrade plan modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 100;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}

#auth-overlay { align-items: center; padding: 24px 20px; }
.modal-overlay.show { display: flex; }

.upgrade-modal {
  position: relative;
  width: 100%;
  max-width: 1000px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 36px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { background: #1c1c23; color: var(--text); }

.upgrade-head { text-align: center; margin-bottom: 26px; }
.upgrade-head h2 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 10px;
}
.upgrade-head p {
  margin: 0 auto;
  max-width: 560px;
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
}

.billing-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 32px;
}
.billing-label {
  color: var(--text-dim);
  font-size: 14.5px;
  font-weight: 500;
}
.billing-label.active { color: var(--text); font-weight: 700; }
.toggle-switch {
  width: 40px;
  height: 22px;
  background: #2a2a34;
  border-radius: 999px;
  position: relative;
  display: inline-block;
}
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
}
.save-badge {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text);
  background: #1c1c23;
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: 6px;
}

.plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.plan-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.plan-header h3 {
  margin: 0 0 4px;
  font-size: 21px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.plan-header p {
  margin: 0 0 18px;
  color: var(--text-dim);
  font-size: 13.5px;
}

.popular-badge {
  background: #ec4899;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 8px;
  border-radius: 999px;
}

.plan-features {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.plan-features li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text);
}
.plan-features svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  color: var(--text);
}

.plan-price {
  font-size: 15px;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.plan-price .price {
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
}

.plan-btn {
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #ec4899, #f97316);
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.plan-btn:hover { opacity: 0.92; }
.plan-btn:active { transform: scale(0.98); }

@media (max-width: 780px) {
  .plans { grid-template-columns: 1fr; }
  .upgrade-modal { padding: 30px 20px; }
  .upgrade-head h2 { font-size: 26px; }
}

/* Log in button (shown when logged out) */
.login-btn {
  background: none;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.login-btn:hover { background: #1c1c23; border-color: #34343f; }

/* Auth (log in / sign up) modal */
.auth-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 26px 18px;
  animation: authModalPopIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

#auth-overlay.show { animation: authOverlayFadeIn 0.18s ease; }
#auth-overlay.closing { animation: authOverlayFadeOut 0.16s ease forwards; }
#auth-overlay.closing .auth-modal { animation: authModalPopOut 0.16s ease forwards; }

@keyframes authOverlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes authOverlayFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes authModalPopIn {
  0% { opacity: 0; transform: scale(0.92) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes authModalPopOut {
  0% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(0.95) translateY(6px); }
}

.auth-title {
  font-size: 21px;
  font-weight: 800;
  margin: 0 0 14px;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.oauth-btn:hover { background: #232329; border-color: #34343f; }
.oauth-icon { flex: 0 0 auto; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0 14px;
  color: var(--text-dimmer);
  font-size: 12.5px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  margin: 0 0 12px;
}

.auth-forgot-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
  margin: 0 0 12px;
}

.auth-form { display: flex; flex-direction: column; gap: 11px; }
.auth-modal[data-mode="login"] .auth-form-signup { display: none; }
.auth-modal[data-mode="signup"] .auth-form-login { display: none; }
.auth-modal[data-mode="signup"] .auth-forgot { display: none; }
.auth-switch-login { display: block; }
.auth-switch-signup { display: none; }
.auth-modal[data-mode="signup"] .auth-switch-login { display: none; }
.auth-modal[data-mode="signup"] .auth-switch-signup { display: block; }

.auth-form-forgot,
.auth-forgot-success,
.auth-switch-forgot { display: none; }
.auth-modal[data-mode="forgot"] .oauth-buttons,
.auth-modal[data-mode="forgot"] .auth-divider,
.auth-modal[data-mode="forgot"] .auth-form-login,
.auth-modal[data-mode="forgot"] .auth-form-signup,
.auth-modal[data-mode="forgot"] .auth-forgot,
.auth-modal[data-mode="forgot"] .auth-switch-login,
.auth-modal[data-mode="forgot"] .auth-switch-signup { display: none; }
.auth-modal[data-mode="forgot"] .auth-form-forgot { display: flex; }
.auth-modal[data-mode="forgot"] .auth-switch-forgot { display: block; }
.auth-modal[data-mode="forgot"].forgot-sent .auth-form-forgot { display: none; }
.auth-modal[data-mode="forgot"].forgot-sent .auth-forgot-success { display: block; }

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}

.auth-field input {
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.auth-field input:focus { border-color: var(--accent); background: #202028; }

.password-wrap { position: relative; display: flex; }
.password-wrap input { flex: 1; padding-right: 40px; }
.password-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-dimmer);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.password-toggle svg { width: 17px; height: 17px; }
.password-toggle:hover { background: #232329; color: var(--text); }

.auth-submit {
  border: none;
  border-radius: 10px;
  padding: 11px;
  font-size: 14.5px;
  font-weight: 700;
  color: #14141a;
  background: #fff;
  margin-top: 2px;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.auth-submit:hover { opacity: 0.92; }
.auth-submit:active { transform: scale(0.98); }
.auth-submit:disabled { opacity: 0.6; cursor: default; }

.auth-forgot {
  display: block;
  text-align: center;
  font-size: 13px;
  color: #a5b4fc;
  margin: 12px 0 8px;
}
.auth-forgot:hover { text-decoration: underline; }

.auth-switch {
  text-align: center;
  font-size: 13.5px;
  color: var(--text-dim);
  margin: 0 0 12px;
}
.auth-switch a { color: #a5b4fc; font-weight: 600; }
.auth-switch a:hover { text-decoration: underline; }

.auth-legal {
  text-align: center;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-dimmer);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin: 0;
}
.auth-legal a { color: var(--text-dim); text-decoration: underline; }

.edit-profile-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px 28px;
}
.edit-profile-modal form { display: flex; flex-direction: column; gap: 16px; }

.auth-field textarea {
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.auth-field textarea:focus { border-color: var(--accent); background: #202028; }

.field-hint {
  color: var(--text-dimmer);
  font-size: 12.5px;
  font-weight: 500;
  margin-top: -3px;
}

.field-count {
  align-self: flex-end;
  color: var(--text-dimmer);
  font-size: 12px;
  font-weight: 500;
  margin-top: -3px;
}

.edit-avatar-field { align-items: center; }
.edit-avatar-field > span { align-self: center; }
.edit-avatar-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.avatar-change-link {
  background: none;
  border: none;
  color: #a5b4fc;
  font-size: 13.5px;
  font-weight: 600;
}
.avatar-change-link:hover { text-decoration: underline; }
.avatar-change-link:disabled { opacity: 0.6; cursor: default; }

.edit-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}
.edit-cancel-btn {
  background: #1c1c23;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.edit-cancel-btn:hover { background: #232329; }
.edit-save-btn {
  background: #22c55e;
  border: none;
  color: #052e13;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  transition: opacity 0.15s ease;
}
.edit-save-btn:hover { opacity: 0.9; }
.edit-save-btn:disabled { opacity: 0.6; cursor: default; }

.people-modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 72vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 20px 16px;
  display: flex;
  flex-direction: column;
}
.people-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 8px;
}
.people-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  padding: 10px 8px;
  border-radius: 10px;
  text-align: left;
  color: var(--text);
  font-size: 14.5px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.people-row:hover { background: #1c1c23; }
.people-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14px;
  padding: 50px 0;
  margin: 0;
}

/* Followers/Following list opens centered in the viewport, not pinned to the top */
#people-overlay { align-items: center; }

/* Avatar crop modal */
.crop-modal {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.crop-viewport {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  overflow: hidden;
  position: relative;
  background: #1c1c23;
  border: 1px solid var(--border);
  margin: 4px 0 20px;
  cursor: grab;
  touch-action: none;
}
.crop-viewport.dragging { cursor: grabbing; }

.crop-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  color: var(--text-dimmer);
  margin-bottom: 22px;
}

.crop-zoom-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

/* Profile view */
.avatar-xl {
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.avatar-xl:hover {
  transform: scale(1.06);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}
.avatar-xl:active { transform: scale(0.97); }

/* Profile picture lightbox */
.avatar-lightbox-overlay {
  align-items: center;
  cursor: zoom-out;
  animation: lightboxFadeIn 0.18s ease;
}

.avatar-huge {
  width: min(360px, 70vw);
  height: min(360px, 70vw);
  cursor: default;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: lightboxPop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3);
}

.avatar-lightbox-overlay.closing {
  animation: lightboxFadeOut 0.18s ease forwards;
}
.avatar-lightbox-overlay.closing .avatar-huge {
  animation: lightboxPopOut 0.18s ease forwards;
}

@keyframes lightboxFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes lightboxFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes lightboxPop {
  0% { opacity: 0; transform: scale(0.6); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes lightboxPopOut {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.6); }
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-bottom: 28px;
}

.profile-name {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 6px;
}

.profile-bio {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 10px;
  max-width: 480px;
}

.profile-stats {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 14px;
}
.profile-stats .dot { margin: 0 6px; color: var(--text-dimmer); }

.stat-link {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  padding: 0;
}
.stat-link:hover { color: var(--text); text-decoration: underline; }

.edit-profile-btn {
  background: #1c1c23;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.edit-profile-btn:hover { background: #232329; }

.follow-btn {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 13.5px;
  font-weight: 700;
  transition: opacity 0.15s ease;
}
.follow-btn:hover { opacity: 0.9; }
.follow-btn.following {
  background: #1c1c23;
  border: 1px solid var(--border);
  color: var(--text);
}

.profile-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.profile-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 14.5px;
  font-weight: 700;
  padding: 10px 14px 12px;
  transition: color 0.15s ease;
}
.profile-tab:hover { color: var(--text); }
.profile-tab.active { color: var(--text); border-bottom-color: var(--accent-2); }
.profile-tab .tab-count {
  color: var(--text-dimmer);
  font-weight: 600;
  font-size: 13px;
}

.profile-toolbar { margin-bottom: 24px; }

.sort-dropdown { position: relative; display: inline-block; }

.sort-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1c1c23;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 700;
}
.sort-dropdown-btn:hover { background: #232329; }

.sort-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  background: #1a1a20;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 6px;
  display: flex;
  flex-direction: column;
  z-index: 30;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.sort-dropdown-menu.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.sort-dropdown-menu button {
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 10px;
  border-radius: 8px;
}
.sort-dropdown-menu button:hover { background: #232329; }
.sort-dropdown-menu button.active { color: #a5b4fc; }

.profile-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14.5px;
  padding: 60px 0;
  margin: 0;
}

/* Notifications panel */
#notif-btn.pop { animation: avatarPop 0.35s ease; }

.notif-overlay {
  display: none;
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}
.notif-overlay.show { display: block; }

.notif-panel {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  background: #1a1a20;
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 40px rgba(0, 0, 0, 0.45);
  z-index: 95;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 0;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.notif-panel.open { transform: translateX(0); }

.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.notif-panel-head h2 { font-size: 20px; font-weight: 800; margin: 0; }

.notif-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.notif-hide-read {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  margin-right: 4px;
}

.icon-btn-sm { width: 32px; height: 32px; }
.icon-btn-sm svg { width: 16px; height: 16px; }

.toggle-switch { cursor: pointer; transition: background 0.15s ease; }
.toggle-switch.checked { background: var(--accent-2); }
.toggle-knob { transition: left 0.15s ease; }
.toggle-switch.checked .toggle-knob { left: 20px; }

.notif-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.notif-tabs::-webkit-scrollbar { display: none; }

.notif-tab {
  flex-shrink: 0;
  white-space: nowrap;
  background: #1c1c23;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 700;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.notif-tab:hover { color: var(--text); }
.notif-tab.active {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #fff;
}

.notif-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #101014;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.notif-search svg { width: 16px; height: 16px; color: var(--text-dimmer); flex-shrink: 0; }
.notif-search input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.notif-search input::placeholder { color: var(--text-dimmer); }

.notif-list {
  flex: 1;
  overflow-y: auto;
  margin: 0 -18px;
  padding: 0 18px;
}

.notif-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 14.5px;
  padding: 60px 0;
  margin: 0;
}

@media (max-width: 480px) {
  .notif-panel { width: 100%; max-width: 100%; }
}

@media (max-width: 560px) {
  .auth-modal { padding: 26px 20px 22px; }
  .profile-head { flex-direction: column; align-items: flex-start; gap: 14px; }
}

/* Generate page */
.gen-layout {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}

.gen-panel {
  width: 460px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}

.gen-workspace {
  flex: 1;
  min-width: 0;
}

.gen-workspace-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.gen-ws-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 10px 8px;
  transition: color 0.15s ease;
}
.gen-ws-tab svg { width: 12px; height: 12px; }
.gen-ws-tab:hover { color: var(--text); }
.gen-ws-tab.active { color: var(--text); border-bottom-color: var(--accent-2); }

.gen-result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.gen-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-dim);
  font-size: 14.5px;
  padding: 90px 0;
  margin: 0;
}

.gen-result-card {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--card-bg);
}

.gen-result-card.loading {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gen-spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: gen-spin 0.8s linear infinite;
}
@keyframes gen-spin { to { transform: rotate(360deg); } }

.gen-result-fill {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
}

.gen-result-card.loading {
  flex-direction: column;
  gap: 10px;
}

.gen-result-status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 6px 8px;
  font-size: 11px;
  text-align: center;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.45);
}

.gen-result-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 13px;
  text-align: center;
  color: #f87171;
}

.gen-model-empty {
  font-size: 12.5px;
  color: var(--text-dim);
  margin: 4px 0;
}

/* Character/Background/Pose/Art Style row */
.gen-row {
  display: flex;
  gap: 8px;
}
.gen-row .gen-select {
  flex: 1;
  min-width: 0;
}
.gen-row .gen-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gen-row .gen-select-btn {
  padding: 10px 8px;
  font-size: 12px;
  gap: 3px;
}

/* Custom select dropdowns */
.gen-select {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.gen-select-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.gen-select-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.gen-select-btn:hover { background: #202028; }

.gen-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gen-chev {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text-dimmer);
  transition: transform 0.15s ease;
}
.gen-select.open .gen-chev,
.gen-accordion-header.open .gen-chev { transform: rotate(180deg); }

.gen-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #1a1a20;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  padding: 6px;
  z-index: 40;
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.gen-select.open .gen-select-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.gen-select-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13.5px;
  padding: 9px 10px;
  border-radius: 8px;
}
.gen-select-menu button:hover { background: #232329; }
.gen-select-menu button.active { color: #a5b4fc; }

/* Extra Options accordion */
.gen-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s ease;
}
.gen-accordion-header:hover { background: #202028; }

.gen-accordion-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 14px;
}
.gen-accordion-body[hidden] { display: none; }

.gen-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gen-field[hidden] { display: none; }
.gen-field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.gen-field textarea,
.gen-text-input {
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.gen-field textarea:focus,
.gen-text-input:focus { border-color: var(--accent); background: #202028; }
.gen-field-count {
  align-self: flex-end;
  font-size: 11.5px;
  color: var(--text-dimmer);
}

/* Model / LoRA card */
.gen-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.gen-card-label {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.gen-model-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gen-model-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gen-model-thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.gen-model-info { flex: 1; min-width: 0; }
.gen-model-kind {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-dimmer);
}
.gen-model-name {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gen-model-weight {
  width: 72px;
  accent-color: var(--accent);
  flex-shrink: 0;
}
.gen-model-weight-value {
  width: 36px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.gen-model-switch-btn,
.gen-model-remove-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.gen-model-switch-btn:hover,
.gen-model-remove-btn:hover { background: #2a2a33; color: var(--text); }

.gen-add-lora-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #232329;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease;
}
.gen-add-lora-btn:hover { background: #282830; color: var(--text); }

/* Generation settings */
.gen-slider-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gen-slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
}
.gen-slider-head span:last-child { color: var(--text); }
.gen-slider-field input[type="range"] { accent-color: var(--accent); width: 100%; }

.gen-upload-box {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  background: #151519;
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 18px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.gen-upload-box:hover { border-color: #3a3a48; color: var(--text); }
.gen-upload-box.has-image { padding: 0; border-style: solid; }
.gen-upload-box img {
  width: 100%;
  border-radius: 9px;
  display: block;
  max-height: 160px;
  object-fit: cover;
}

.gen-generate-btn {
  position: sticky;
  bottom: 0;
  width: 100%;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(90deg, #22c55e, #16a34a);
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.gen-generate-btn:hover { opacity: 0.92; }
.gen-generate-btn:active { transform: scale(0.98); }
.gen-generate-btn:disabled { opacity: 0.65; cursor: default; }

/* Pick Checkpoint / Pick LoRA modal */
.pick-model-modal {
  position: relative;
  width: 100%;
  max-width: 960px;
  max-height: 82vh;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px 26px 26px;
  display: flex;
  flex-direction: column;
}

.pick-model-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pick-model-head h2 { font-size: 22px; font-weight: 800; margin: 0; }
.pick-model-head .modal-close { position: static; }

.pick-model-tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.pick-model-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 1px 12px;
  transition: color 0.15s ease;
}
.pick-model-tab:hover { color: var(--text); }
.pick-model-tab.active { color: var(--text); border-bottom-color: var(--accent-2); }

.pick-model-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.pick-model-search {
  flex: 1;
  max-width: 300px;
  margin-left: auto;
}

.pick-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 16px;
  overflow-y: auto;
  padding-bottom: 4px;
}

.pick-model-tile {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
}

.pick-model-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.pick-model-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #fff;
  background: rgba(168, 85, 247, 0.92);
  text-transform: uppercase;
}

.pick-model-tile h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-model-tile-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pick-model-tile-foot span { font-size: 12px; color: var(--text-dimmer); }

.pick-model-use-btn {
  background: #232329;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 700;
  transition: background 0.15s ease;
}
.pick-model-use-btn:hover { background: #2a2a33; }

@media (max-width: 900px) {
  .gen-layout { flex-direction: column; }
  .gen-panel { width: 100%; position: static; max-height: none; }
}

/* Responsive */
@media (max-width: 860px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-h);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
  }
  .sidebar.open { transform: translateX(0); }
  .overlay.show { display: block; }
  .hamburger { display: flex; }
  .content { padding: 20px 16px 48px; }
  .unlock-btn-content span { display: none; }
  .unlock-btn { padding: 9px 12px; }
}

/* ---------- Image library: feed / grid / lightbox ---------- */

.avatar-md { width: 40px; height: 40px; }

.post-feed-head { margin-top: 40px; }

.post-feed {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 520px;
  margin: 0 auto;
}
.post-feed .thumb { aspect-ratio: 3 / 4; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
@media (max-width: 1100px) { .post-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 780px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .post-grid { grid-template-columns: 1fr; } }

.post-multi-badge {
  left: auto;
  right: 10px;
  background: rgba(0, 0, 0, 0.6);
}

/* Lightbox overlay */
.post-lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 6, 9, 0.94);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.post-lightbox-overlay.show { display: flex; }

.post-lightbox {
  position: relative;
  width: 100%;
  max-width: 1360px;
  height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.lightbox-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  pointer-events: none;
}
.lightbox-topbar-left,
.lightbox-topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.lightbox-icon-btn,
.lightbox-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(20, 20, 26, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lightbox-icon-btn { width: 38px; height: 38px; justify-content: center; padding: 0; }
.lightbox-icon-btn svg { width: 18px; height: 18px; }
.lightbox-pill-btn { padding: 8px 14px; font-size: 13.5px; font-weight: 600; }
.lightbox-pill-btn svg { width: 15px; height: 15px; }
.lightbox-icon-btn:hover,
.lightbox-pill-btn:hover { background: rgba(40, 40, 50, 0.95); }

.lightbox-popover-wrap { position: relative; }
.lightbox-popover {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  width: 260px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.lightbox-popover.show { display: block; }

.popover-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }
.popover-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 10px;
}
.popover-close-x {
  background: none;
  border: none;
  color: var(--text-dim);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.popover-close-x svg { width: 14px; height: 14px; }

.popover-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.popover-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 4px;
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
}
.popover-tile:hover { background: #232329; }
.popover-tile-icon { width: 20px; height: 20px; }
.popover-tile-icon svg { width: 100%; height: 100%; }
.popover-tile-reddit .popover-tile-icon { color: #ff4500; }
.popover-tile-x .popover-tile-icon { color: #fff; background: #000; border-radius: 50%; }

.popover-list { display: flex; flex-direction: column; gap: 2px; }
.popover-radio-row,
.popover-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text);
  padding: 9px 6px;
  border-radius: 8px;
  font-size: 13.5px;
  text-align: left;
  width: 100%;
}
.popover-radio-row:hover,
.popover-menu-item:hover { background: #232329; }
.popover-radio {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.6px solid var(--text-dimmer);
  flex-shrink: 0;
}
.popover-menu-item svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-dim); }
.popover-menu-item-danger { color: #f87171; }
.popover-menu-item-danger svg { color: #f87171; }

.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 20, 26, 0.8);
  border: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-nav-btn:hover { background: rgba(40, 40, 50, 0.95); }
.lightbox-nav-btn svg { width: 20px; height: 20px; }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }

.lightbox-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.lightbox-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}
.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-reactions {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 5;
}
.reaction-pill {
  background: rgba(20, 20, 26, 0.85);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
}
.reaction-pill:hover { background: rgba(40, 40, 50, 0.95); }
.reaction-pill.active { border-color: var(--accent); background: var(--accent-soft); }

.lightbox-dots {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 5;
}
.lightbox-dot {
  width: 22px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.35);
  cursor: pointer;
}
.lightbox-dot.active { background: #fff; }

.lightbox-info-panel {
  width: 340px;
  flex-shrink: 0;
  background: var(--card-bg);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 74px 18px 18px;
}
.lightbox-info-panel.collapsed { display: none; }

.info-uploader-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.info-uploader-meta { display: flex; flex-direction: column; min-width: 0; }
.info-uploader-name { font-weight: 700; font-size: 14.5px; }
.info-uploader-date { font-size: 12px; color: var(--text-dim); }
.info-follow-btn { margin-left: auto; padding: 7px 16px; font-size: 13px; }

.info-description { font-size: 13.5px; color: var(--text-dim); line-height: 1.5; margin: 0 0 14px; }

.info-tags-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.info-tag {
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 12px;
  color: var(--text-dim);
}

.info-card {
  background: #1a1a20;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}
.info-card-title { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.info-card-label { font-size: 11.5px; color: var(--text-dimmer); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.info-pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.info-pill-row:last-child { margin-bottom: 0; }
.info-pill {
  background: var(--accent-soft);
  color: #c4b5fd;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
}
.info-pill-plain { background: #232329; color: var(--text-dim); }

.info-resource-row { display: flex; align-items: center; justify-content: space-between; }
.info-resource-name { font-size: 13.5px; font-weight: 600; color: #a5b4fc; }
.info-resource-type { font-size: 12px; color: var(--text-dimmer); }
.info-checkpoint-badge { position: static; background: rgba(99, 102, 241, 0.9); }

.info-discussion-card { padding-bottom: 10px; }
.comment-list { display: flex; flex-direction: column; gap: 14px; max-height: 360px; overflow-y: auto; margin-bottom: 12px; }
.comment-empty { font-size: 13px; color: var(--text-dimmer); }
.comment-item { display: flex; gap: 8px; }
.comment-body { flex: 1; min-width: 0; }
.comment-head { display: flex; align-items: baseline; gap: 8px; }
.comment-author { font-weight: 700; font-size: 13px; color: #a5b4fc; }
.comment-time { font-size: 11.5px; color: var(--text-dimmer); }
.comment-text { font-size: 13px; margin: 3px 0 6px; line-height: 1.5; white-space: pre-wrap; }
.comment-actions { display: flex; gap: 14px; }
.comment-like-btn,
.comment-reply-btn {
  background: none;
  border: none;
  color: var(--text-dimmer);
  font-size: 12px;
  font-weight: 600;
  padding: 0;
}
.comment-like-btn:hover,
.comment-reply-btn:hover { color: var(--text); }
.comment-like-btn.active { color: var(--accent); }
.comment-replies { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }

.comment-form { display: flex; align-items: center; gap: 8px; }
.comment-form input {
  flex: 1;
  background: #1c1c23;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
}
.comment-form input::placeholder { color: var(--text-dimmer); }
.comment-form input:disabled { opacity: 0.5; }

@media (max-width: 900px) {
  .post-lightbox { height: 100vh; border-radius: 0; }
  .lightbox-body { flex-direction: column; overflow-y: auto; }
  .lightbox-stage { min-height: 50vh; }
  .lightbox-info-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
}
