/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #050a14;
  --surface: #0a1120;
  --surface-2: #111c2e;
  --border: rgba(255,255,255,0.07);
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #4a5568;
  --accent: #f59e0b;
  --accent-dim: rgba(245,158,11,0.12);
  --accent-glow: rgba(245,158,11,0.25);
  --purple: #7c3aed;
  --purple-dim: rgba(124,58,237,0.15);
  --font-head: 'Fraunces', Georgia, serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --max-w: 1280px;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* === TYPOGRAPHY === */
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.2; }
a { color: var(--accent); text-decoration: none; transition: opacity 0.2s; }
a:hover { opacity: 0.8; }

/* === NAVBAR === */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(5,10,20,0.85); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.navbar-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.navbar-logo {
  font-family: var(--font-head); font-size: 1.25rem; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em;
}
.navbar-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 32px; list-style: none; }
.nav-links a { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.mobile-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.mobile-toggle svg { width: 24px; height: 24px; stroke: var(--text); }

/* === HERO === */
.hero {
  position: relative; min-height: 100vh;
  display: flex; align-items: center; overflow: hidden;
  padding: 120px 24px 80px;
}
.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 20% 50%, rgba(124,58,237,0.18) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 80% 30%, rgba(245,158,11,0.08) 0%, transparent 60%),
    radial-gradient(ellipse 80% 40% at 50% 100%, rgba(124,58,237,0.10) 0%, transparent 60%),
    linear-gradient(180deg, #050a14 0%, #070d1a 50%, #050a14 100%);
  z-index: 0;
}
.hero-bg::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(1px 1px at 60% 20%, rgba(255,255,255,0.25) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1px 1px at 35% 70%, rgba(255,255,255,0.2) 0%, transparent 100%),
    radial-gradient(1px 1px at 55% 80%, rgba(255,255,255,0.15) 0%, transparent 100%),
    radial-gradient(2px 2px at 15% 55%, rgba(245,158,11,0.5) 0%, transparent 100%),
    radial-gradient(2px 2px at 70% 45%, rgba(124,58,237,0.5) 0%, transparent 100%),
    radial-gradient(2px 2px at 40% 15%, rgba(255,255,255,0.4) 0%, transparent 100%);
  background-size: 600px 600px;
  animation: drift 80s linear infinite;
}
@keyframes drift {
  0% { transform: translateY(0); }
  100% { transform: translateY(-600px); }
}
.hero-content {
  position: relative; z-index: 1; max-width: var(--max-w); margin: 0 auto; width: 100%;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent-dim); border: 1px solid rgba(245,158,11,0.2);
  color: var(--accent); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 6px 14px; border-radius: 100px;
  margin-bottom: 24px;
}
.hero h1 {
  font-size: clamp(3rem, 7vw, 5.5rem);
  background: linear-gradient(135deg, #fff 0%, #e2e8f0 50%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  max-width: 14ch; margin-bottom: 24px; line-height: 1.05;
}
.hero p {
  font-size: 1.2rem; color: var(--text-muted); max-width: 54ch; line-height: 1.7;
  margin-bottom: 40px;
}
.hero-ctas { display: flex; gap: 16px; flex-wrap: wrap; }
.btn-primary {
  background: var(--accent); color: #000; font-weight: 700;
  padding: 14px 28px; border-radius: 8px; font-size: 0.95rem;
  border: none; cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); opacity: 1; }
.btn-secondary {
  background: var(--surface-2); color: var(--text);
  padding: 14px 28px; border-radius: 8px; font-size: 0.95rem;
  border: 1px solid var(--border); cursor: pointer; transition: all 0.2s;
  display: inline-flex; align-items: center; gap: 8px;
}
.btn-secondary:hover { border-color: rgba(255,255,255,0.15); opacity: 1; }

/* === SECTIONS === */
.section { padding: 96px 24px; }
.section-sm { padding: 64px 24px; }
.section-header { text-align: center; max-width: 700px; margin: 0 auto 64px; }
.section-eyebrow {
  color: var(--accent); font-size: 0.8rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 12px;
}
.section-header h2 {
  font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 16px;
}
.section-header p { color: var(--text-muted); font-size: 1.1rem; }
.container { max-width: var(--max-w); margin: 0 auto; }

/* === FEATURE CARDS === */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; }
.feature-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 32px; transition: all 0.3s;
}
.feature-card:hover { border-color: rgba(255,255,255,0.12); transform: translateY(-4px); }
.feature-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent-dim); display: flex; align-items: center; justify-content: center;
  margin-bottom: 20px; font-size: 1.5rem;
}
.feature-card h3 { font-size: 1.2rem; margin-bottom: 12px; }
.feature-card p { color: var(--text-muted); font-size: 0.95rem; line-height: 1.6; }

/* === VIDEO SECTION === */
.video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 24px; }
.video-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; transition: all 0.3s; }
.video-card:hover { border-color: rgba(255,255,255,0.12); }
.video-thumb { position: relative; aspect-ratio: 16/9; overflow: hidden; }
.video-thumb iframe { width: 100%; height: 100%; border: none; }
.video-info { padding: 20px; }
.video-info h3 { font-size: 1rem; margin-bottom: 8px; line-height: 1.4; }
.video-info p { color: var(--text-muted); font-size: 0.85rem; }

/* === TOPICS GRID === */
.topics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.topic-chip {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 100px; padding: 12px 24px; text-align: center;
  color: var(--text-muted); font-size: 0.9rem; transition: all 0.2s; cursor: default;
}
.topic-chip:hover { border-color: var(--accent); color: var(--accent); }

/* === ABOUT SECTION === */
.about-section { background: linear-gradient(180deg, var(--bg) 0%, var(--surface) 50%, var(--bg) 100%); }
.about-content { display: grid; grid-template-columns: 1fr 1.5fr; gap: 64px; align-items: center; }
.about-image {
  aspect-ratio: 3/4; border-radius: 24px; overflow: hidden;
  background: var(--surface-2); display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border);
}
.about-image img { width: 100%; height: 100%; object-fit: cover; }
.about-text h2 { font-size: 2.5rem; margin-bottom: 24px; }
.about-text p { color: var(--text-muted); font-size: 1.05rem; line-height: 1.8; margin-bottom: 24px; }
.stats-row { display: flex; gap: 40px; margin-top: 32px; }
.stat { }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--accent); font-family: var(--font-head); }
.stat-label { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* === NEWSLETTER === */
.newsletter-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 24px; padding: 64px; text-align: center;
  margin: 0 24px 64px; max-width: calc(var(--max-w) - 48px);
}
.newsletter-section h2 { font-size: 2.5rem; margin-bottom: 12px; }
.newsletter-section p { color: var(--text-muted); margin-bottom: 32px; font-size: 1.05rem; }
.newsletter-form { display: flex; gap: 12px; max-width: 480px; margin: 0 auto; flex-wrap: wrap; justify-content: center; }
.newsletter-form input {
  flex: 1; min-width: 260px; padding: 14px 20px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  font-size: 0.95rem; outline: none; transition: border-color 0.2s;
}
.newsletter-form input:focus { border-color: var(--accent); }
.newsletter-form input::placeholder { color: var(--text-dim); }
.btn-subscribe { background: var(--accent); color: #000; font-weight: 700; padding: 14px 28px; border-radius: 8px; border: none; cursor: pointer; font-size: 0.95rem; transition: all 0.2s; white-space: nowrap; }
.btn-subscribe:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-glow); }
.newsletter-success { display: none; color: #22c55e; font-weight: 600; padding: 16px; }
.newsletter-error { display: none; color: #ef4444; font-size: 0.85rem; margin-top: 8px; }

/* === CREDIBILITY LOGOS === */
.credibility-section { padding: 48px 24px; border-top: 1px solid var(--border); }
.credibility-inner { max-width: var(--max-w); margin: 0 auto; text-align: center; }
.credibility-label { color: var(--text-dim); font-size: 0.8rem; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 24px; }
.credibility-logos { display: flex; gap: 48px; justify-content: center; align-items: center; flex-wrap: wrap; }
.credibility-logo { color: var(--text-dim); font-weight: 600; font-size: 0.9rem; letter-spacing: 0.05em; opacity: 0.5; transition: opacity 0.2s; }
.credibility-logo:hover { opacity: 1; }

/* === FOOTER === */
.footer { padding: 48px 24px; border-top: 1px solid var(--border); }
.footer-inner { max-width: var(--max-w); margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 24px; }
.footer-left { color: var(--text-muted); font-size: 0.85rem; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { color: var(--text-muted); font-size: 0.85rem; }

/* === PAGE HERO (subpages) === */
.page-hero {
  padding: 160px 24px 80px;
  text-align: center;
  position: relative; overflow: hidden;
}
.page-hero::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 50% at 50% 30%, rgba(124,58,237,0.15) 0%, transparent 70%);
  z-index: 0;
}
.page-hero-content { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.page-hero h1 { font-size: clamp(2.5rem, 5vw, 4rem); margin-bottom: 20px; }
.page-hero p { color: var(--text-muted); font-size: 1.1rem; }

/* === BIO SECTION === */
.bio-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.bio-image {
  aspect-ratio: 4/5; border-radius: 24px; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; align-items: flex-end; justify-content: center;
}
.bio-content h2 { font-size: 2rem; margin-bottom: 24px; }
.bio-content p { color: var(--text-muted); line-height: 1.8; margin-bottom: 20px; }
.bio-content ul { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.bio-content li { display: flex; align-items: center; gap: 12px; color: var(--text-muted); }
.bio-content li::before { content: '✓'; color: var(--accent); font-weight: 700; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .mobile-toggle { display: block; }
  .about-content { grid-template-columns: 1fr; gap: 40px; }
  .about-image { max-width: 400px; margin: 0 auto; }
  .bio-grid { grid-template-columns: 1fr; }
  .stats-row { gap: 24px; }
  .hero h1 { max-width: 100%; }
  .newsletter-section { padding: 40px 24px; margin: 0 16px 40px; }
  .video-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .hero-ctas { flex-direction: column; }
  .btn-primary, .btn-secondary { width: 100%; justify-content: center; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form input { min-width: 100%; }
  .stats-row { flex-direction: column; gap: 16px; }
}

/* === THUMBNAIL STUDIO === */
.studio-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: start;
}

.studio-left { display: flex; flex-direction: column; gap: 32px; }
.studio-right { position: sticky; top: 80px; }

.studio-section h3 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.upload-zone svg { opacity: 0.5; }
.upload-zone p { font-size: 0.95rem; margin: 0; }
.upload-zone span { font-size: 0.8rem; opacity: 0.6; }

.frame-presets {
  display: flex;
  gap: 12px;
}

.frame-preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.frame-preset:hover, .frame-preset.active {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.frame-preset span { font-size: 0.75rem; color: var(--text-muted); }

.preview-canvas-wrap {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#preview-canvas {
  max-width: 100%;
  display: block;
}

.action-bar {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 16px;
}

.studio-status {
  margin-top: 12px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 0.875rem;
  text-align: center;
}
.studio-status.loading { background: var(--surface-2); color: var(--text-muted); }
.studio-status.success { background: var(--accent-dim); color: var(--accent); }
.studio-status.error { background: rgba(239,68,68,0.15); color: #ef4444; }

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

.thumb-item {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
}
.thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumb-item .thumb-status {
  position: absolute;
  bottom: 4px;
  right: 4px;
  font-size: 0.65rem;
  background: rgba(5,10,20,0.8);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
}
.thumb-item.published .thumb-status { color: var(--accent); }

.research-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.research-ideas-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.research-idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.research-idea-card:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.research-idea-card .idea-topic {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.research-idea-card .idea-pitch {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.research-idea-card.applied {
  border-color: var(--accent);
  background: var(--accent-dim);
}

@media (max-width: 900px) {
  .studio-layout { grid-template-columns: 1fr; }
  .studio-right { position: static; }
}

/* === RESEARCH PAGE === */
.research-form-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.type-toggle {
  display: flex;
  gap: 8px;
}

.type-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.type-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

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

.idea-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.2s;
}

.idea-card:hover { border-color: var(--accent); }

.idea-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.idea-title {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.demand-badge {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
}

.demand-badge--high { background: rgba(34,197,94,0.15); color: #4ade80; }
.demand-badge--mid  { background: rgba(245,158,11,0.15); color: var(--accent); }
.demand-badge--low  { background: var(--surface-2); color: var(--text-muted); }

.competition-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  width: fit-content;
}

.competition-tag--low  { background: rgba(34,197,94,0.12); color: #4ade80; }
.competition-tag--mid  { background: rgba(245,158,11,0.12); color: var(--accent); }
.competition-tag--high { background: rgba(239,68,68,0.12);  color: #f87171; }

.seasonal-signal {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
}

.save-btn {
  align-self: flex-start;
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.save-btn:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.save-btn.saved {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  cursor: default;
}

.gen-thumb-btn {
  align-self: flex-start;
  padding: 6px 14px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  text-decoration: none;
  display: inline-block;
}
.gen-thumb-btn:hover {
  background: rgba(245,158,11,0.22);
  opacity: 1;
}

.backlog-counter {
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 8px;
}

/* === KEYWORD CLUSTERS === */
.clusters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.cluster-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s;
}

.cluster-group:hover { border-color: rgba(255,255,255,0.12); }

.cluster-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cluster-index-badge {
  font-family: var(--font-head);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.cluster-count {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  line-height: 1.3;
}

.kw-chip--high { background: rgba(34,197,94,0.12); color: #4ade80; border-color: rgba(34,197,94,0.2); }
.kw-chip--mid  { background: rgba(245,158,11,0.12); color: var(--accent); border-color: rgba(245,158,11,0.2); }
.kw-chip--low  { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

.kw-intent {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 4px;
  opacity: 0.8;
}

.intent--info        { background: var(--purple-dim); color: #a78bfa; }
.intent--commercial  { background: var(--accent-dim); color: var(--accent); }
.intent--nav         { background: var(--surface-2); color: var(--text-muted); }
.intent--trans       { background: rgba(34,197,94,0.12); color: #4ade80; }

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

/* === THUMBNAIL GENERATOR PAGE === */
.gen-form {
  max-width: 600px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.gen-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}

.gen-input::placeholder { color: var(--text-dim); }
.gen-input:focus { border-color: var(--accent); }

.gen-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.gen-thumb-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.gen-thumb-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.gen-thumb-card.selected {
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.gen-thumb-card.approved {
  border: 2px solid #22c55e;
}

.gen-thumb-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.gen-thumb-footer {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gen-thumb-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.approve-btn {
  padding: 5px 12px;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  white-space: nowrap;
}

.approve-btn:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.approve-btn:disabled { opacity: 0.5; cursor: default; }

.ab-checkbox-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.ab-panel {
  background: var(--surface-2);
  border: 1px solid var(--accent-dim);
  border-radius: 12px;
  padding: 24px;
  margin-top: 32px;
}

.ab-previews {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.ab-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.ab-preview img {
  width: 160px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.ab-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.ab-result {
  margin-top: 16px;
  background: var(--surface);
  border-radius: 8px;
  padding: 16px;
  border: 1px solid var(--border);
}

.ab-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.ab-stat:last-child { border-bottom: none; }

.ab-dashboard {
  margin-top: 24px;
}

.ab-dashboard-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.ab-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.ab-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.ab-row-title {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.ab-row-winner {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.ab-variants {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.ab-variant {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ab-variant.winner {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.ab-variant-img {
  width: 100%;
  max-width: 160px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  align-self: flex-start;
}

.ab-variant-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.ab-variant-stats > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.ab-variant-stats > div:last-child { border-bottom: none; }

.ab-ctr {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.ab-ctr.winner {
  color: var(--accent);
}

.ab-variant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.ab-promote-btn[disabled] { opacity: 0.5; cursor: default; }

@media (max-width: 600px) {
  .gen-grid { grid-template-columns: 1fr; }
  .ab-variants { grid-template-columns: 1fr; }
}

/* Recent Thumbnails gallery */
.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}
.recent-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}
.recent-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.recent-card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.recent-card-img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.recent-card-body { padding: 10px 12px; font-size: 0.85rem; color: var(--text-muted); }
.recent-card-title { color: var(--text); font-weight: 600; margin-bottom: 6px; word-break: break-word; }
.recent-card-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.recent-card-style {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.7rem;
  background: var(--surface-2); color: var(--text-muted);
}
.recent-card .badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.7rem;
  background: var(--accent-dim); color: var(--accent);
}
.recent-card .badge.status-approved { background: rgba(34,197,94,0.15); color: #22c55e; }
.recent-card .badge.status-published { background: rgba(59,130,246,0.15); color: #60a5fa; }
.recent-card .badge.badge-winner { background: rgba(34,197,94,0.15); color: #22c55e; }
.recent-card .badge.badge-active { background: rgba(245,158,11,0.15); color: var(--accent); }
.recent-card .badge.badge-source { background: rgba(99,102,241,0.15); color: #818cf8; }
.recent-card-actions { display: flex; gap: 8px; padding: 8px 12px 12px; }
.recent-card-actions button { flex: 1; padding: 6px 8px; font-size: 0.78rem; }
.recent-card-actions button[disabled] { opacity: 0.6; cursor: default; }
.recent-loaded {
  margin-top: 24px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
}