/* ===========================
   AI Resource Hub — Base Styles
   Light, clean, minimal design system
   =========================== */

:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f2f8f4;
  --color-border: #d7e5da;
  --color-text: #1c231e;
  --color-text-muted: #59665c;
  --color-accent: #1a8a44;
  --color-accent-hover: #146536;
  --color-accent-soft: #e2f4e8;
  --color-success: #15803d;
  --color-gold: #fdd10a;
  --color-gold-hover: #e2ba00;
  --color-red: #ce1126;
  --color-red-soft: #fbe2e4;
  --color-header-bg: rgba(255, 255, 255, 0.92);
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --max-width: 1120px;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Dark theme palette — applied when <html data-theme="dark"> */
[data-theme="dark"] {
  --color-bg: #0f1410;
  --color-bg-alt: #171d18;
  --color-border: #2a3a2e;
  --color-text: #e9ede9;
  --color-text-muted: #9db3a3;
  --color-accent: #3ddc73;
  --color-accent-hover: #64e592;
  --color-accent-soft: #17301f;
  --color-success: #3ddc73;
  --color-gold: #ffd400;
  --color-gold-hover: #ffe14d;
  --color-red: #ff5b6a;
  --color-red-soft: #3a1a1e;
  --color-header-bg: rgba(15, 20, 16, 0.88);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .info-banner {
  border-color: #26402c;
}

[data-theme="dark"] .lightbox-overlay {
  background: rgba(0, 0, 0, 0.85);
}

[data-theme="dark"] img:not(.upload-preview):not(.gallery-item img):not(.lightbox-content img) {
  opacity: 0.92;
}

html {
  transition: background-color 0.15s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  color: var(--color-accent-hover);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-header-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  border-top: 4px solid;
  border-image: linear-gradient(90deg, var(--color-red) 0 33%, var(--color-gold) 33% 66%, var(--color-accent) 66% 100%) 1;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  max-width: 1320px;
  margin: 0 auto;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--color-text);
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-brand .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-gold);
  color: #14210f;
  font-weight: 800;
  font-size: 0.95rem;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 18px;
  list-style: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.nav-links a {
  color: var(--color-text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--color-text);
}

.nav-cta {
  background: var(--color-gold);
  color: #14210f !important;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-cta:hover {
  background: var(--color-gold-hover);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
  }
  .nav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 8px 24px 16px;
    display: none;
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links li {
    width: 100%;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
  }
  .nav-links li:last-child {
    border-bottom: none;
  }
  .nav-cta {
    display: inline-block;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: 80px 0 64px;
  text-align: center;
}

.eyebrow {
  display: inline-block;
  background: var(--color-gold);
  color: #14210f;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.15;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}

.hero p.lead {
  font-size: 1.15rem;
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  color: #fff;
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-secondary:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

/* ---------- Sections ---------- */

section {
  padding: 56px 0;
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 40px;
}

.section-header h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.section-header p {
  color: var(--color-text-muted);
  margin: 0;
}

.alt-bg {
  background: var(--color-bg-alt);
}

/* ---------- Cards / Grid ---------- */

.grid {
  display: grid;
  gap: 20px;
}

.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 860px) {
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card .icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 14px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card p {
  color: var(--color-text-muted);
  margin: 0;
  font-size: 0.95rem;
}

/* ---------- Resource Directory ---------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 40px;
}

.filter-btn {
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.filter-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.resource-category {
  margin-bottom: 48px;
}

.resource-category h2 {
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.resource-category .category-desc {
  color: var(--color-text-muted);
  margin: 0 0 20px;
  font-size: 0.95rem;
}

.resource-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.resource-card .tag {
  display: inline-block;
  align-self: flex-start;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.resource-card h3 {
  margin: 0 0 6px;
}

.resource-card p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin: 0 0 14px;
  flex-grow: 1;
}

.resource-card a.visit-link {
  font-weight: 600;
  font-size: 0.88rem;
}

/* ---------- Prompt Generator ---------- */

.tool-tabs {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.tool-tab {
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--color-text-muted);
}

.tool-tab.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.generator-panel {
  display: none;
}

.generator-panel.active {
  display: block;
}

.generator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

@media (max-width: 860px) {
  .generator-layout {
    grid-template-columns: 1fr;
  }
}

.form-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.field input[type="text"],
.field select,
.field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--color-text);
  background: var(--color-bg);
}

.field textarea {
  resize: vertical;
  min-height: 70px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.output-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  position: sticky;
  top: 88px;
}

.output-card h3 {
  margin-top: 0;
}

#promptOutput {
  width: 100%;
  min-height: 160px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
}

.output-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.copy-feedback {
  display: none;
  color: var(--color-success);
  font-weight: 600;
  font-size: 0.85rem;
  margin-top: 10px;
}

.copy-feedback.show {
  display: block;
}

/* ---------- AI enhance (Prompt Generator) ---------- */

.ai-enhance-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.ai-enhance-status {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: none;
}

.ai-enhance-status.show {
  display: inline;
}

.ai-enhance-status.success {
  color: var(--color-success);
  font-weight: 600;
}

.ai-enhance-status.error {
  color: var(--color-red);
}

.ai-enhance-auth-note {
  margin: 14px 0 0;
  padding: 10px 14px;
  font-size: 0.82rem;
}

#textPromptOutput.ai-enhanced,
#imagePromptOutput.ai-enhanced,
#videoPromptOutput.ai-enhanced {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

/* The three output boxes auto-grow to fit their content via JS (see
   autoGrowOutput() in prompt-generator.js). max-height caps that growth so
   a long result doesn't turn the box into a tall, skinny column that looks
   out of proportion with the rest of the card — past the cap it scrolls
   internally instead (overflow-y: auto), same as it always could by hand
   via the resize handle.
   width is set explicitly here because these textareas live directly
   inside .output-card rather than inside a .field wrapper, so they never
   picked up the width: 100% every other input/textarea on this page gets —
   without this they fall back to the browser's default ~20-column
   intrinsic width, which is why the box was rendering much narrower than
   the info banner above it. box-sizing: border-box keeps the padding from
   pushing it past the card's edge now that width is explicit. */
#textPromptOutput,
#imagePromptOutput,
#videoPromptOutput {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
  font-size: 0.88rem;
  min-height: 220px;
  max-height: 420px;
  line-height: 1.55;
  overflow-y: auto;
}

@media (max-width: 640px) {
  #textPromptOutput,
  #imagePromptOutput,
  #videoPromptOutput {
    min-height: 180px;
    max-height: 340px;
  }
}

/* ---------- Ad Slots ---------- */

.ad-slot {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.ad-slot .ad-placeholder {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.8rem;
  background: var(--color-bg-alt);
}

/* ---------- Forms (Contact) ---------- */

.contact-form {
  max-width: 560px;
  margin: 0 auto;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 4px solid;
  border-image: linear-gradient(90deg, var(--color-accent) 0 33%, var(--color-gold) 33% 66%, var(--color-red) 66% 100%) 1;
  padding: 40px 0 28px;
  margin-top: 40px;
  background: var(--color-bg-alt);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
}

.footer-links {
  display: flex;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 0;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.footer-bottom {
  border-top: 1px solid var(--color-border);
  padding-top: 20px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* ---------- Misc pages ---------- */

.page-header {
  padding: 56px 0 24px;
  text-align: center;
}

.page-header h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 12px;
}

.page-header p {
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.prose {
  max-width: 760px;
  margin: 0 auto;
}

.prose h2 {
  margin-top: 36px;
}

.prose p,
.prose li {
  color: var(--color-text-muted);
}

.info-banner {
  background: var(--color-accent-soft);
  border: 1px solid #bfe3cb;
  border-radius: var(--radius);
  padding: 16px 20px;
  font-size: 0.9rem;
  color: var(--color-accent-hover);
  margin-bottom: 28px;
}

/* ---------- Model note (Prompt Generator) ---------- */

.model-note {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

/* ---------- Gallery ---------- */

.gallery-toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.gallery-search {
  flex: 1;
  min-width: 220px;
}

.gallery-search input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.gallery-search input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.gallery-sort select {
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-bg);
  cursor: pointer;
}

.gallery-sort select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.gallery-toolbar #openUploadBtn {
  flex-shrink: 0;
}

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

@media (max-width: 960px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .gallery-grid { grid-template-columns: 1fr; }
}

.gallery-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.gallery-item-body {
  padding: 12px 14px;
}

.gallery-item-body h4 {
  margin: 0 0 4px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-item-body p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-item-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.gallery-item-footer .gallery-tags {
  max-height: 3.4em;
  overflow: hidden;
}

.gallery-item-footer .card-like-btn {
  margin-top: 1px;
}

.gallery-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.gallery-tags .tag {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---------- Likes ---------- */

.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.like-btn .like-heart {
  font-size: 1rem;
  line-height: 1;
}

.like-btn.liked,
.like-btn.liked .like-heart {
  color: var(--color-red);
}

.card-like-btn {
  border: 1px solid transparent;
  background: var(--color-bg-alt);
  color: var(--color-text-muted);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.card-like-btn:hover {
  color: var(--color-red);
}

.card-like-btn.liked {
  background: var(--color-red-soft);
}

#lightboxLikeBtn.liked {
  border-color: var(--color-red);
}

.gallery-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

.upload-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  max-width: 560px;
  margin: 0 auto 48px;
}

.upload-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  margin-top: 10px;
  display: none;
  background: var(--color-bg-alt);
}

.upload-preview.show {
  display: block;
}

.form-status {
  font-size: 0.85rem;
  margin-top: 12px;
  display: none;
}

.form-status.show {
  display: block;
}

.form-status.success {
  color: var(--color-success);
}

.form-status.error {
  color: var(--color-red);
}

/* Lightbox modal */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 21, 26, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.lightbox-overlay.open {
  display: flex;
}

.lightbox-content {
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.lightbox-content img {
  width: 100%;
  max-height: 380px;
  object-fit: contain;
  background: var(--color-bg-alt);
}

.lightbox-body {
  padding: 22px;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 1rem;
}

/* Gallery setup banner is hidden until JS determines Supabase isn't configured */
#setupBanner {
  display: none;
}
#setupBanner.show {
  display: block;
}

/* ---------- Nav auth slot ---------- */

.nav-auth-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-auth-email {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

.nav-auth-signout {
  background: none;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-auth-signout:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

@media (max-width: 760px) {
  .nav-auth-slot {
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
  }
}

/* ---------- Auth page ---------- */

.auth-card {
  max-width: 420px;
  margin: 0 auto;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}

.auth-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px;
}

.auth-tab {
  flex: 1;
  padding: 9px 0;
  border-radius: 8px;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.auth-tab.active {
  background: var(--color-accent);
  color: #fff;
}

.auth-panel {
  display: none;
}

.auth-panel.active {
  display: block;
}

.auth-logged-in {
  text-align: center;
}

.auth-logged-in p {
  color: var(--color-text-muted);
}

.auth-divider {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 24px 0 18px;
  position: relative;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(50% - 90px);
  border-top: 1px solid var(--color-border);
}

.auth-divider::before { left: 0; }
.auth-divider::after { right: 0; }

.access-request-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px;
}

/* ---------- Gallery: video + visibility additions ---------- */

video.upload-preview {
  width: 100%;
}

#authRequiredBanner {
  display: none;
}
#authRequiredBanner.show {
  display: block;
}

.visibility-toggle {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.visibility-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  font-size: 0.88rem;
  color: var(--color-text);
  cursor: pointer;
}

.visibility-option input {
  accent-color: var(--color-accent);
}

/* Portrait "reel" style thumbnail: a fixed 9:16 box that always shows the
   ENTIRE photo/video (object-fit: contain) instead of cropping a slice out
   of it. Landscape uploads letterbox with bars above/below inside the same
   portrait frame rather than being cropped into a thin sliver; portrait
   uploads fill it edge-to-edge. */
.gallery-item video,
.gallery-item img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  background: var(--color-bg-alt);
  display: block;
}

.gallery-item .tag.private {
  background: var(--color-red-soft);
  color: var(--color-red);
}

.gallery-media-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.gallery-item {
  position: relative;
}

/* Floating native-resolution video preview shown on card hover — sized to
   the video's actual aspect ratio (no cropping), unlike the grid thumbnail. */
.gallery-hover-preview {
  position: fixed;
  z-index: 300;
  pointer-events: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  background: #000;
  line-height: 0;
}

.gallery-hover-preview video {
  display: block;
  width: auto;
  height: auto;
  max-width: min(90vw, 420px);
  max-height: min(80vh, 420px);
}

#lightboxVideo {
  display: none;
  width: 100%;
  max-height: 380px;
  background: #000;
}

/* Auth page setup banner is hidden until JS determines Supabase isn't configured */
#authSetupBanner {
  display: none;
}
#authSetupBanner.show {
  display: block;
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
  color: var(--color-text-muted);
}

.theme-toggle:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

@media (max-width: 760px) {
  .nav-links li:has(.theme-toggle) {
    border-bottom: none;
    padding: 10px 0 0;
  }
}

/* ---------- Prompt Generator: Basic / Advanced mode ---------- */

.mode-toggle {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 28px;
}

.mode-btn {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.mode-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.advanced-field {
  display: none;
}

.mode-advanced .advanced-field {
  display: block;
}

/* ---------- Admin panel ---------- */

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 4px;
}

.admin-tab {
  flex: 1;
  min-width: 120px;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: none;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.admin-tab.active {
  background: var(--color-accent);
  color: #fff;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.admin-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.admin-inline-form input[type="email"],
.admin-inline-form input[type="text"] {
  flex: 1;
  min-width: 160px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
}

.admin-inline-form select {
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
}

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

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--color-bg);
}

.admin-row-main {
  flex: 1;
  min-width: 0;
}

.admin-row-meta {
  display: inline-block;
  margin-left: 10px;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.admin-row-note {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  word-break: break-word;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.admin-empty {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.admin-stat-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--color-bg-alt);
}

.admin-stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-text);
}

.admin-stat-label {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.admin-stat-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  font-size: 0.82rem;
  color: var(--color-text);
}

.admin-stat-list li {
  padding: 2px 0;
}

@media (max-width: 640px) {
  .admin-row {
    flex-direction: column;
  }
}

/* ---------- Comments & remixes ---------- */

.lightbox-comments {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

.comments-heading {
  margin: 0 0 14px;
  font-size: 1rem;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}

.comments-empty {
  color: var(--color-text-muted);
  font-size: 0.88rem;
  margin: 0 0 18px;
}

.comment-row {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 40px 12px 14px;
  background: var(--color-bg-alt);
  position: relative;
}

.comment-meta {
  margin-bottom: 4px;
}

.comment-author {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-accent);
}

.comment-body {
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--color-text);
  white-space: pre-wrap;
}

.comment-remix {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 4px 12px 4px 4px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-bg);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-accent);
}

.comment-remix img,
.comment-remix video {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 999px;
  background: var(--color-bg-alt);
}

.comment-remix:hover {
  border-color: var(--color-accent);
}

.comment-remix-hidden {
  background: none;
  border: none;
  padding: 0;
  color: var(--color-text-muted);
  font-weight: 400;
  cursor: default;
}

.comment-delete {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 0.74rem;
  cursor: pointer;
  text-decoration: underline;
}

.comment-delete:hover {
  color: var(--color-red);
}

.comment-composer textarea#commentBody {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--color-text);
  background: var(--color-bg);
  resize: vertical;
  min-height: 60px;
  margin-bottom: 10px;
  display: block;
}

.comment-composer textarea#commentBody:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

#toggleRemixBtn {
  display: inline-block;
  margin-bottom: 12px;
}

.remix-subform {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: var(--color-bg-alt);
}

#postCommentBtn {
  margin-right: 8px;
}

/* Remix badge shown on grid cards for posts that riff on another post */
.remix-of {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-accent);
  margin-bottom: 4px;
  cursor: pointer;
}

.remix-of:hover {
  text-decoration: underline;
}

.remix-of-hidden {
  color: var(--color-text-muted);
  cursor: default;
}

/* ---------- Cover thumbnail picker (upload / remix / edit) ---------- */

.cover-picker {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--color-bg-alt);
}

.cover-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.cover-mode-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  cursor: pointer;
}

.cover-mode-btn.active {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}

.cover-frame-mode input[type="range"] {
  width: 100%;
  accent-color: var(--color-accent);
}

.cover-frame-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.cover-photo-mode input[type="file"] {
  width: 100%;
}

#editCoverResetBtn {
  margin-top: 12px;
}

.remix-of-hidden:hover {
  text-decoration: none;
}

/* ============================================================
   Gallery reports + workflow attachment + admin moderation
   ============================================================ */

.required-mark { color: #e5484d; font-weight: 700; }

.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-text-muted, #8a8a8a);
}
.btn-ghost:hover {
  color: var(--color-text, #111);
  border-color: var(--color-border, #ddd);
}

/* Push the Report button to the right edge of the lightbox action row */
.lightbox-report-btn { margin-left: auto; }

/* The report + admin-email modals sit above the lightbox (z-index 100) */
#reportModalOverlay,
#emailModalOverlay { z-index: 400; }
.report-modal { max-width: 540px; }

/* Admin: reported-posts list */
.admin-flag-row { align-items: flex-start; gap: 12px; }
.admin-flag-thumb {
  width: 64px; height: 64px; border-radius: 8px; object-fit: cover;
  flex: 0 0 auto; background: var(--color-bg-alt, #ececec);
  display: inline-flex; align-items: center; justify-content: center;
}
.admin-flag-thumb-video { color: var(--color-text-muted, #8a8a8a); font-size: 1.4rem; }
.admin-flag-actions { flex-wrap: wrap; gap: 6px; }
.admin-note { color: #b26a00; }
[data-theme="dark"] .admin-note { color: #e0a54a; }

/* Internal moderator-to-uploader notices (shown on the gallery) */
.user-notice { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.user-notice-body { flex: 1 1 auto; }
.user-notice-body p { margin: 6px 0 0; }
.user-notice-dismiss { flex: 0 0 auto; }

/* Guides section (index cards) */
.guide-list { display: grid; gap: 16px; margin: 24px 0 8px; }
.guide-card {
  padding: 20px 22px;
  border: 1px solid var(--color-border, #e2e2e2);
  border-radius: 12px;
  background: var(--color-bg-alt, #fafafa);
}
.guide-card h3 { margin: 0 0 6px; font-size: 1.15rem; }
.guide-card h3 a { text-decoration: none; }
.guide-card p { margin: 0; color: var(--color-text-muted, #6a6a6a); }
@media (min-width: 720px) { .guide-list { grid-template-columns: 1fr 1fr; } }

/* Prompt generator: fields hidden because they don't apply to the chosen model */
.field.field-hidden-model { display: none !important; }

/* AI Transitions — frame extractor tool */
.transitions-tool { max-width: 900px; margin: 0 auto; }
.transitions-results { display: grid; gap: 20px; margin-top: 24px; }
@media (min-width: 720px) { .transitions-results { grid-template-columns: 1fr 1fr; } }
.frame-card { border: 1px solid var(--color-border, #e2e2e2); border-radius: 12px; padding: 18px; background: var(--color-bg-alt, #fafafa); }
.frame-card h3 { margin: 0 0 12px; }
.frame-preview { background: #000; border-radius: 8px; overflow: hidden; display: flex; align-items: center; justify-content: center; min-height: 120px; }
.frame-preview img { width: 100%; height: auto; display: block; max-height: 340px; object-fit: contain; }
.frame-res { margin: 12px 0; font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 0.9rem; color: var(--color-text-muted, #6a6a6a); }

/* AI Transitions — "Blend two clips" generator */
.blend-tool { max-width: 900px; margin: 0 auto; }
.blend-divider { display: flex; align-items: center; text-align: center; color: var(--color-text-muted, #6a6a6a); max-width: 900px; margin: 0 auto 8px; }
.blend-divider::before, .blend-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border, #e2e2e2); }
.blend-divider span { padding: 0 16px; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8rem; }
.blend-inputs { display: grid; gap: 16px; }
@media (min-width: 720px) { .blend-inputs { grid-template-columns: 1fr 1fr; } }
.blend-mode { display: flex; flex-direction: column; gap: 8px; }
.blend-radio { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.blend-radio input { width: auto; margin: 0; }
.blend-progress { margin-top: 18px; }
.blend-progress-bar { height: 10px; border-radius: 999px; background: var(--color-border, #e2e2e2); overflow: hidden; }
.blend-progress-bar > span { display: block; height: 100%; width: 0; background: var(--color-primary, #6c5ce7); transition: width 0.4s ease; }
.blend-progress-label { margin: 8px 0 0; font-size: 0.9rem; color: var(--color-text-muted, #6a6a6a); }
.blend-result { margin-top: 24px; }
.blend-video { width: 100%; max-height: 460px; background: #000; border-radius: 10px; display: block; }

/* AI Transitions — Identity Lock + prompt tools */
.blend-prompt-tools { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.btn-small { padding: 6px 12px; font-size: 0.85rem; }

/* AI Transitions — render archive (My Renders) */
.archive-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .archive-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .archive-grid { grid-template-columns: 1fr 1fr 1fr; } }
.archive-card { border: 1px solid var(--color-border, #e2e2e2); border-radius: 12px; padding: 14px; background: var(--color-bg-alt, #fafafa); }
.archive-video { width: 100%; max-height: 260px; background: #000; border-radius: 8px; display: block; }
.archive-prompt { margin: 10px 0 2px; font-size: 0.92rem; line-height: 1.4; }
.blend-archive-wrap { margin-top: 8px; }

/* Danger / delete buttons */
.btn-danger { background: #c0392b; color: #fff; border: 1px solid #c0392b; }
.btn-danger:hover { background: #a93226; border-color: #a93226; }
.btn-danger:disabled { opacity: 0.6; cursor: default; }

/* AI Transitions — project folders */
.folder-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; }
.folder-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.folder-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--color-border, #e2e2e2); background: var(--color-bg-alt, #fafafa); cursor: pointer; font-size: 0.9rem; }
.folder-chip.active { background: var(--color-primary, #6c5ce7); color: #fff; border-color: var(--color-primary, #6c5ce7); }
.folder-del { border: none; background: transparent; color: inherit; cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 2px; opacity: 0.7; }
.folder-del:hover { opacity: 1; }
.archive-move-wrap { margin: 6px 0 10px; }
.archive-move { width: 100%; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--color-border, #e2e2e2); background: var(--color-bg, #fff); font-size: 0.85rem; }

/* AI Transitions — mode toggle (AI Transition / Music Sync) */
.mode-switch { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border: 1px solid var(--color-border, #e2e2e2); border-radius: 999px; background: var(--color-bg-alt, #fafafa); }
.mode-btn { border: none; background: transparent; padding: 8px 20px; border-radius: 999px; cursor: pointer; font-size: 0.92rem; color: var(--color-text, inherit); }
.mode-btn.active { background: var(--color-primary, #6c5ce7); color: #fff; }

/* AI Transitions — music-sync callout note (clean block, not flex) */
.blend-note { display: block; background: var(--color-bg-alt, #fafafa); border: 1px solid var(--color-border, #e2e2e2); border-left: 3px solid var(--color-primary, #6c5ce7); border-radius: 8px; padding: 12px 16px; margin: 0 0 20px; font-size: 0.92rem; line-height: 1.55; color: var(--color-text, inherit); }
.blend-note strong { font-weight: 600; }

/* Render "Expand" lightbox — larger centered popup (not fullscreen) */
.render-lightbox { position: fixed; inset: 0; z-index: 500; display: none; align-items: center; justify-content: center; padding: 28px; background: rgba(0,0,0,0.82); }
.render-lightbox.open { display: flex; }
.render-lightbox-inner { position: relative; width: min(90vw, 1100px); max-height: 88vh; }
.render-lightbox-video { width: 100%; max-height: 88vh; background: #000; border-radius: 12px; display: block; }
.render-lightbox-close { position: absolute; top: -16px; right: -16px; width: 42px; height: 42px; border-radius: 50%; border: none; background: #fff; color: #111; font-size: 26px; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.4); z-index: 2; }
.render-lightbox-close:hover { background: #eee; }
/* Image lightbox (Image Studio): fit the whole picture on screen, any aspect
   ratio, and stack the download button beneath it. */
#imgLightbox .render-lightbox-inner { width: auto; max-width: min(92vw, 1100px); display: flex; flex-direction: column; align-items: center; gap: 14px; }
#imgLightbox .render-lightbox-inner img { max-width: 100%; max-height: 82vh; width: auto; height: auto; object-fit: contain; background: #000; border-radius: 12px; display: block; }
/* Selected camera-move button (Motion Transfer) */
.blend-prompt-tools .btn.selected { border-color: var(--color-gold); color: var(--color-gold); box-shadow: 0 0 0 1px var(--color-gold) inset; }
/* Activity/status chips (My Activity + admin drill-down) */
.status-chip { display: inline-block; padding: 7px 13px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(120,130,145,0.14); border: 1px solid rgba(120,130,145,0.32); color: inherit; }
.nav-auth-activity { margin-right: 12px; font-size: 0.9rem; white-space: nowrap; }

/* ---- Profiles ---- */
.profile-header { display: flex; gap: 24px; align-items: flex-start; padding-top: 30px; flex-wrap: wrap; }
.profile-avatar { width: 130px; height: 130px; border-radius: 50%; object-fit: cover; background: #222; border: 3px solid var(--color-gold, #e8b64c); }
.profile-avatar-sm { width: 64px; height: 64px; border-width: 2px; }
.profile-meta { flex: 1; min-width: 240px; }
.profile-name { color: var(--color-gold, #e8b64c); margin: 0 0 6px; }
.profile-bio { margin: 0 0 12px; white-space: pre-wrap; }
.profile-socials { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.profile-social { padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none; background: rgba(120,130,145,0.14); border: 1px solid rgba(120,130,145,0.32); }
.profile-social:hover { border-color: var(--color-gold, #e8b64c); color: var(--color-gold, #e8b64c); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---- Messages ---- */
.messages-layout { display: grid; grid-template-columns: 300px 1fr; gap: 18px; min-height: 60vh; }
.messages-list { border: 1px solid rgba(120,130,145,0.28); border-radius: 12px; overflow: auto; max-height: 70vh; }
.conv-item { display: block; width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid rgba(120,130,145,0.18); padding: 12px 14px; cursor: pointer; color: inherit; }
.conv-item:hover, .conv-item.active { background: rgba(120,130,145,0.12); }
.conv-name { display: block; font-weight: 700; }
.conv-unread { display: inline-block; min-width: 18px; text-align: center; padding: 0 6px; margin-left: 6px; border-radius: 999px; font-size: 11px; background: var(--color-gold, #e8b64c); color: #111; }
.conv-prev { display: block; font-size: 12px; opacity: 0.7; margin-top: 2px; }
.messages-thread { display: flex; flex-direction: column; border: 1px solid rgba(120,130,145,0.28); border-radius: 12px; overflow: hidden; }
.messages-thread-head { padding: 12px 16px; border-bottom: 1px solid rgba(120,130,145,0.22); }
.thread-name { font-weight: 700; text-decoration: none; color: var(--color-gold, #e8b64c); }
.messages-scroll { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; max-height: 56vh; }
.msg-bubble { max-width: 75%; padding: 9px 13px; border-radius: 14px; font-size: 14px; line-height: 1.4; position: relative; }
.msg-bubble.mine { align-self: flex-end; background: var(--color-gold, #e8b64c); color: #111; border-bottom-right-radius: 4px; }
.msg-bubble.theirs { align-self: flex-start; background: rgba(120,130,145,0.18); border-bottom-left-radius: 4px; }
.msg-time { display: block; font-size: 10px; opacity: 0.6; margin-top: 4px; }
.messages-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid rgba(120,130,145,0.22); }
.messages-compose input { flex: 1; padding: 10px 12px; border-radius: 999px; border: 1px solid rgba(120,130,145,0.35); background: transparent; color: inherit; }
@media (max-width: 720px) { .messages-layout { grid-template-columns: 1fr; } .messages-list { max-height: 30vh; } }

/* File-input thumbnails (AI Transitions + Motion Transfer pickers) */
.file-thumb { margin-top: 10px; }
.file-thumb img, .file-thumb video { max-width: 100%; max-height: 170px; display: block; border-radius: 8px; background: #000; border: 1px solid var(--color-border, #e2e2e2); }
.file-thumb-loading { font-size: 0.85rem; color: var(--color-text-muted, #6a6a6a); }

/* Global render-status pill (fixed, top-right, on every page) */
.render-pill {
  position: fixed; top: 74px; right: 16px; z-index: 1200;
  display: flex; align-items: stretch; gap: 0;
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: 999px; box-shadow: var(--shadow-md);
  max-width: min(360px, calc(100vw - 32px)); overflow: hidden;
  font-family: var(--font-body);
}
.render-pill-main {
  display: flex; align-items: center; gap: 9px;
  background: transparent; border: 0; cursor: pointer;
  padding: 8px 6px 8px 14px; min-width: 0; color: var(--color-text);
}
.render-pill-body { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.render-pill-text {
  font-size: 0.82rem; font-weight: 600; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.render-pill-track {
  margin-top: 5px; width: 220px; max-width: 100%; height: 4px;
  background: var(--color-border); border-radius: 999px; overflow: hidden;
}
.render-pill-fill { display: block; height: 100%; width: 2%; background: var(--color-accent); transition: width 0.4s ease; }
.render-pill-dot {
  flex: none; width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-accent); box-shadow: 0 0 0 0 var(--color-accent);
  animation: render-pulse 1.6s ease-out infinite;
}
.render-pill.is-done .render-pill-dot { background: var(--color-success); animation: none; }
.render-pill.is-done .render-pill-fill { background: var(--color-success); }
.render-pill.is-error .render-pill-dot { background: var(--color-red); animation: none; }
.render-pill.is-error .render-pill-fill { background: var(--color-red); }
.render-pill-close {
  background: transparent; border: 0; border-left: 1px solid var(--color-border);
  cursor: pointer; color: var(--color-text-muted); font-size: 1.1rem; line-height: 1;
  padding: 0 12px; align-self: stretch;
}
.render-pill-close:hover { color: var(--color-text); background: var(--color-bg-alt); }
@keyframes render-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(26, 138, 68, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(26, 138, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(26, 138, 68, 0); }
}
@media (max-width: 640px) {
  .render-pill { top: auto; bottom: 16px; right: 12px; left: 12px; max-width: none; }
  .render-pill-track, .render-pill-text { width: auto; max-width: none; }
}

/* Render Status page (GPU + current render) */
.status-card {
  background: var(--color-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.status-row { display: flex; justify-content: space-between; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--color-border); }
.status-row:last-of-type { border-bottom: 0; }
.status-key { color: var(--color-text-muted); font-size: 0.9rem; }
.status-val { font-weight: 600; text-align: right; }
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 14px; }
.status-metric { background: var(--color-bg-alt); border-radius: var(--radius); padding: 12px 14px; text-align: center; }
.status-metric-label { display: block; font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 4px; }
.status-metric-val { display: block; font-size: 1.25rem; font-weight: 700; }
.gpu-card { background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 18px; }
.gpu-name { font-weight: 700; margin-bottom: 12px; }
.gpu-meter { margin: 10px 0; }
.gpu-meter-head { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 4px; }
.gpu-meter-track { height: 8px; background: var(--color-border); border-radius: 999px; overflow: hidden; }
.gpu-meter-track > span { display: block; height: 100%; background: var(--color-accent); border-radius: 999px; transition: width 0.5s ease; }
.gpu-sub { display: flex; gap: 18px; margin-top: 10px; font-size: 0.9rem; color: var(--color-text-muted); }
@media (max-width: 560px) { .status-grid { grid-template-columns: 1fr; } }

/* Range sliders (Motion Transfer fps + steps) */
.range-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  background: var(--color-border); border-radius: 999px; outline: none; margin: 6px 0 2px;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--color-accent); cursor: pointer; border: 3px solid var(--color-bg); box-shadow: var(--shadow-sm);
}
.range-slider::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: var(--color-accent);
  cursor: pointer; border: 3px solid var(--color-bg); box-shadow: var(--shadow-sm);
}
.range-ticks { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--color-text-muted); margin-top: 2px; }
.range-ticks > span { flex: 1; text-align: center; }
.range-ticks > span:first-child { text-align: left; }
.range-ticks > span:last-child { text-align: right; }

/* Image Studio */
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.model-card {
  display: flex; flex-direction: column; text-align: left; cursor: pointer;
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  overflow: hidden; padding: 0; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.model-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.model-card.selected { border-color: var(--color-accent); box-shadow: 0 0 0 2px var(--color-accent); }
.model-thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  background-size: cover; background-position: center;
}
.model-badge {
  position: absolute; top: 8px; left: 8px; font-size: 0.7rem; font-weight: 700;
  background: rgba(0,0,0,0.6); color: #fff; padding: 2px 8px; border-radius: 999px;
}
.model-badge-lora { left: auto; right: 8px; background: rgba(26,138,68,0.85); }
.model-name { font-weight: 700; padding: 10px 12px 2px; color: var(--color-gold); }
.model-card .model-note { padding: 0 12px 12px; font-size: 0.82rem; color: var(--color-text-muted); margin: 0; }

.lora-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lora-select {
  flex: 1; min-width: 180px; padding: 9px 12px; border-radius: var(--radius);
  border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text); font-size: 0.95rem;
}

.image-results { margin-top: 20px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.image-cell-wrap { position: relative; }
.image-cell { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border); background: #000; }
.image-cell img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1; }
.image-del {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(206,17,38,0.9); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.image-del:hover { background: var(--color-red); }

/* Yellow title text (category headers + page/section titles) */
.model-category-title {
  color: var(--color-gold); font-size: 1.2rem; font-weight: 800;
  margin: 28px 0 12px; letter-spacing: 0.2px;
}
.model-category-title:first-child { margin-top: 6px; }
.page-header h1,
.section-header h2,
.section-header h3 { color: var(--color-gold); }

/* Admin: model thumbnail manager */
.thumb-admin-card { text-align: center; }
.thumb-admin-img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover;
  border-radius: var(--radius); border: 1px solid var(--color-border); background: #000;
}
