:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #252540;
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-light: #a78bfa;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --border: #333355;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --sidebar-width: 25vw;
  --sidebar-min: 300px;
  --sidebar-max: 420px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header */
.header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100;
  position: relative;
}

.header h1 {
  font-size: 1.3rem;
  color: var(--accent-light);
  font-weight: 600;
  cursor: pointer;
}

.header nav {
  display: flex;
  gap: 1rem;
}

.header nav {
  align-items: center;
}

.header nav button {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.header nav button:hover,
.header nav button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.header nav button.theme-toggle {
  padding: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header nav button.theme-toggle:hover {
  background: none;
  color: var(--text-primary);
  border-color: var(--accent);
}

.header nav button.theme-toggle.active {
  background: none;
  color: var(--text-secondary);
  border-color: var(--border);
}

/* ===================== HOME / LANDING VIEW ===================== */
.home-view {
  display: none;
  height: calc(100vh - 60px);
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.home-view.active {
  display: flex;
}

.home-content {
  text-align: center;
  max-width: 700px;
  padding: 2rem;
}

.home-hero h2 {
  font-size: 2rem;
  color: var(--accent-light);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.home-hero p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 3rem;
}

.home-actions {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  align-items: stretch;
}

.home-action-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.home-group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  font-weight: 700;
  text-align: center;
  opacity: 0.8;
}

.home-group-cards {
  display: flex;
  gap: 1rem;
  flex: 1;
}

.home-action-divider {
  width: 1px;
  background: linear-gradient(transparent, var(--border), transparent);
  margin: 1.5rem 0.5rem;
  flex-shrink: 0;
}

.home-action-card {
  background: rgba(26, 26, 46, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 2rem 1.5rem;
  cursor: pointer;
  text-align: center;
  transition: all 0.3s;
  width: 220px;
  color: inherit;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.home-action-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.2);
}

.action-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.action-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.action-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ===================== ONBOARDING MODAL ===================== */
.modal.onboarding-modal-body {
  max-width: 760px;
  width: 92%;
  max-height: 92vh;
  padding: 0;
  text-align: center;
  position: relative;
  overflow-y: auto;
}

.onboarding-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  z-index: 2;
  line-height: 1;
}

.onboarding-close:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--bg-tertiary);
}

.onboarding-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding-top: 24px;
}

.onboarding-dots .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: all 0.3s;
}

.onboarding-dots .dot.active {
  background: var(--accent);
  width: 24px;
  border-radius: 4px;
}

.onboarding-step {
  display: none;
  padding: 2rem 2.5rem 2.5rem;
}

.onboarding-step.active {
  display: block;
}

.onboarding-hero {
  margin-bottom: 2.5rem;
}

.onboarding-logo-mark {
  width: auto;
  height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  color: white;
  margin: 0 auto 1.25rem;
}

.modal.onboarding-modal-body h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.onboarding-lead {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
}

.onboarding-features {
  display: flex;
  gap: 1.25rem;
  justify-content: center;
  flex-wrap: wrap;
}

.onboarding-feature-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  text-align: left;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  width: 200px;
  transition: border-color 0.2s;
}

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

.feature-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: white;
}

.feature-icon-describe {
  background: linear-gradient(135deg, #6366f1, #818cf8);
}

.feature-icon-generate {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.feature-icon-tune {
  background: linear-gradient(135deg, #22c55e, #4ade80);
}

.feature-card-icon svg {
  width: 20px;
  height: 20px;
}

.feature-card-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.feature-card-text strong {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 600;
}

.feature-card-text span {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.onboarding-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 2rem;
  padding-bottom: 0.5rem;
}

.onboarding-btn-next {
  min-width: 120px;
}

/* Step 2 */
.onboarding-step2-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.onboarding-flow {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  margin: 0 0 0.5rem;
}

.flow-step {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.25rem 1.25rem;
  width: 180px;
  text-align: center;
  position: relative;
}

.flow-step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
}

.flow-step-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  color: var(--accent-light);
}

.flow-label {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.flow-step p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.flow-example {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-style: italic;
  background: var(--bg-tertiary);
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  line-height: 1.35;
}

.flow-connector {
  display: flex;
  align-items: center;
  padding-top: 3.5rem;
}

.flow-connector span {
  display: block;
  width: 32px;
  height: 2px;
  background: var(--border);
  position: relative;
}

.flow-connector span::after {
  content: '';
  position: absolute;
  right: 0;
  top: -3px;
  border: 4px solid transparent;
  border-left-color: var(--border);
}

.flow-preview-mini {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-dots {
  display: flex;
  gap: 6px;
}

.mini-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: miniPulse 1.5s infinite;
}

.mini-dots span:nth-child(2) { animation-delay: 0.2s; }
.mini-dots span:nth-child(3) { animation-delay: 0.4s; }
.mini-dots span:nth-child(4) { animation-delay: 0.6s; }
.mini-dots span:nth-child(5) { animation-delay: 0.8s; }

@keyframes miniPulse {
  0%, 100% { opacity: 0.3; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

.flow-gallery-mini {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.mini-tile {
  width: 24px;
  height: 18px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  opacity: 0.6;
}

.mini-tile.accent {
  background: linear-gradient(135deg, var(--success), #4ade80);
}

/* ===================== WORKSPACE VIEW ===================== */
.workspace-view {
  display: none;
  height: calc(100vh - 60px);
}

.workspace-view.active {
  display: flex;
}

/* Sidebar */
.workspace-sidebar {
  width: clamp(var(--sidebar-min), var(--sidebar-width), var(--sidebar-max));
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: relative;
  transition: width 0.3s ease, min-width 0.3s ease;
  overflow: hidden;
}

.workspace-sidebar.collapsed {
  width: 48px !important;
  min-width: 48px !important;
}

.workspace-sidebar.collapsed .sidebar-inner {
  opacity: 0;
  pointer-events: none;
}

.sidebar-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  z-index: 5;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  border-color: var(--accent);
}

.workspace-sidebar.collapsed .sidebar-toggle {
  right: auto;
  left: 10px;
  transform: rotate(180deg);
}

.sidebar-inner {
  padding: 1.5rem;
  padding-top: 2.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  transition: opacity 0.2s ease;
}

.sidebar-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-anim-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-light);
}

.sidebar-anim-origin {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-style: italic;
}

/* Tuning Controls */
.tuning-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Color Palette section — always visible prominently */
.tuning-color-palette {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tuning-palette-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-light);
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.tuning-empty {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 1rem 0;
}

.tuning-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tuning-field label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  text-transform: capitalize;
}

.tuning-field label span {
  color: var(--accent-light);
  font-family: monospace;
  font-size: 0.72rem;
}

.tuning-field input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  outline: none;
}

.tuning-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.tuning-color-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tuning-color-row label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  min-width: 70px;
  text-transform: capitalize;
}

.tuning-color-row input[type="color"] {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: none;
  padding: 0;
}

.tuning-color-row input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.tuning-color-row input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border);
  border-radius: 3px;
}

.tuning-color-row .tuning-hex {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.25rem 0.4rem;
  border-radius: 4px;
  width: 80px;
  font-size: 0.75rem;
  font-family: monospace;
}

.tuning-field.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

.tuning-field input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Chat button in sidebar */
.sidebar-chat-btn {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.6rem 1rem;
}

.sidebar-chat-hint {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  text-align: center;
}

.sidebar-bottom {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.workspace-sidebar.collapsed .sidebar-bottom {
  opacity: 0;
  pointer-events: none;
}

.sidebar-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.sidebar-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Preview area */
.workspace-preview {
  flex: 1;
  min-width: 0;
  position: relative;
  overflow: hidden;
  background: #000;
}

.workspace-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ===================== SECTIONS ===================== */
.section {
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  padding: 1rem;
}

.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  font-weight: 600;
}

/* ===================== BUTTONS ===================== */
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

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

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

.btn-outline {
  background: transparent;
  color: var(--accent-light);
  border: 1px solid var(--accent);
}

.btn-outline:hover {
  background: rgba(99, 102, 241, 0.15);
  color: var(--text-primary);
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.25rem 0.4rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.btn-icon.copied {
  border-color: var(--success);
  color: var(--success);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #16a34a;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Ensure snippet & save modals render above lightbox (z-index: 2000) */
#snippet-modal,
#save-modal {
  z-index: 3000;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.modal h2 {
  font-size: 1.2rem;
  color: var(--accent-light);
  margin-bottom: 1rem;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* ===================== CREATOR CHAT MODAL ===================== */
.creator-chat-modal-body {
  max-width: 1200px;
  width: 95%;
  max-height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.creator-chat-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  flex-shrink: 0;
}

.creator-chat-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.creator-chat-modal-header h2 {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 0;
}

.creator-chat-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
}

.creator-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.creator-build-btn {
  padding: 0.5rem 1.25rem;
  font-weight: 600;
}

.creator-chat-header-actions .btn-secondary.btn-sm {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-secondary);
}

/* Three-panel layout */
.creator-chat-panels {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Suggestions panel (left) */
.creator-chat-suggestions {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.suggestions-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.suggestions-header svg {
  color: var(--accent-light);
  flex-shrink: 0;
}

.suggestion-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-card:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.suggestion-card-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.suggestion-card-desc {
  font-size: 0.7rem;
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.suggestion-loading {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 1rem 0;
}

.suggestions-refresh {
  width: 100%;
  justify-content: center;
  margin-top: 0.5rem;
  font-size: 0.75rem;
}

/* Chat center panel */
.creator-chat-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid var(--border);
}

/* Concept right panel */
.creator-chat-right {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 1rem;
}

.concept-panel-placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
}

.concept-placeholder-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--bg-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  color: var(--border);
}

.concept-placeholder-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.concept-placeholder-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.7;
  line-height: 1.4;
  max-width: 200px;
}

.concept-card-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.concept-ready-hint {
  margin-top: 1rem;
  padding: 0.6rem 0.75rem;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius);
  font-size: 0.8rem;
  color: var(--success);
}

/* API Key Setup */
.creator-setup {
  padding: 0.5rem 1.25rem;
  flex-shrink: 0;
}

.creator-setup .section {
  padding: 0.75rem;
}

.setup-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.api-key-row {
  display: flex;
  gap: 0.5rem;
}

.api-key-field {
  flex: 1;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: monospace;
}

.api-key-field:focus {
  outline: none;
  border-color: var(--accent);
}

.api-key-connected {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--success);
  padding: 0.3rem 0;
}

/* Chat Messages */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-bubble {
  max-width: 90%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-bubble.ai {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}

.chat-bubble.user {
  background: var(--accent);
  color: white;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

.chat-bubble.thinking {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  align-self: flex-start;
  font-style: italic;
}

.chat-bubble.thinking .dots {
  display: inline-block;
  animation: dotPulse 1.5s infinite;
}

@keyframes dotPulse {
  0%, 20% { opacity: 0.3; }
  50% { opacity: 1; }
  80%, 100% { opacity: 0.3; }
}

/* Concept Card */
.concept-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem;
  flex-shrink: 0;
}

.concept-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 0.3rem;
}

.concept-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.concept-colors {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.concept-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.concept-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.concept-elements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.concept-tag {
  background: var(--bg-secondary);
  color: var(--accent-light);
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chat Input */
.chat-input-area {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-input-area textarea {
  width: 100%;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  resize: none;
  font-family: inherit;
  font-size: 0.88rem;
  margin-bottom: 0.5rem;
}

.chat-input-area textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-actions {
  display: flex;
  gap: 0.5rem;
}

/* ===================== SNIPPET ===================== */
.snippet-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.snippet-tab {
  flex: 1;
  background: var(--bg-primary);
  border: none;
  color: var(--text-secondary);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.2s;
}

.snippet-tab:not(:last-child) {
  border-right: 1px solid var(--border);
}

.snippet-tab:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.snippet-tab.active {
  background: var(--accent);
  color: white;
}

.snippet-output {
  position: relative;
}

.snippet-output pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  max-height: 200px;
  color: var(--accent-light);
}

.snippet-output .copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
}

/* ===================== GALLERY ===================== */
.gallery-view {
  display: none;
  height: calc(100vh - 60px);
  overflow-y: auto;
}

.gallery-view.active {
  display: block;
}

/* ---- Gallery Preview Hero Carousel ---- */
.gallery-preview-hero {
  position: relative;
  height: 320px;
  overflow: hidden;
  background: #000;
}

.gallery-featured-banner {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.9), rgba(168, 85, 247, 0.9));
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
}

.featured-banner-text {
  letter-spacing: 0.02em;
}

.featured-banner-dismiss {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0 0.25rem;
  line-height: 1;
  transition: color 0.2s;
}

.featured-banner-dismiss:hover {
  color: #fff;
}

.gallery-preview-frame-wrap {
  width: 100%;
  height: 100%;
  position: relative;
}

.gallery-preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.gallery-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 2rem 2rem 1.25rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  pointer-events: none;
}

.gallery-preview-info {
  flex: 1;
  min-width: 0;
}

.gallery-preview-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2rem;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}

.gallery-preview-desc {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 500px;
}

/* Preview hero rating */
.gallery-preview-rating {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-top: 0.35rem;
  pointer-events: all;
}

/* Dual rating layout (preview + lightbox + cards) */
.dual-rating {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.dual-rating-row {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.dual-rating-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  min-width: 48px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.preview-star {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 1rem;
  padding: 0 1px;
  transition: color 0.15s, transform 0.15s;
}

span.preview-star {
  cursor: default;
}

button.preview-star {
  cursor: pointer;
}

button.preview-star:hover {
  color: var(--warning);
  transform: scale(1.2);
}

.preview-star.filled {
  color: var(--warning);
}

.preview-rating-count {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.4);
  margin-left: 0.25rem;
}

/* Card dual rating */
.card-dual-rating {
  padding: 0 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.card-rating-row {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.card-rating-label {
  font-size: 0.6rem;
  color: var(--text-secondary);
  min-width: 38px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.card-rating-count {
  font-size: 0.6rem;
  color: var(--text-secondary);
  margin-left: 0.2rem;
}

.card-dual-rating .star {
  font-size: 0.9rem;
  color: var(--border);
  background: none;
  border: none;
  padding: 0;
}

.card-dual-rating span.star {
  cursor: default;
}

.card-dual-rating button.star {
  cursor: pointer;
}

.card-dual-rating button.star:hover {
  color: var(--warning);
}

.card-dual-rating .star.filled {
  color: var(--warning);
}

/* Lightbox rating */
.lightbox-title-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.lightbox-dual-rating {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.lightbox-rating-group {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.lightbox-rating-label {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-right: 0.15rem;
}

.lightbox-star {
  background: none;
  border: none;
  color: rgba(255,255,255,0.3);
  font-size: 1rem;
  padding: 0 1px;
  transition: color 0.15s;
}

span.lightbox-star {
  cursor: default;
}

button.lightbox-star {
  cursor: pointer;
}

button.lightbox-star:hover {
  color: var(--warning);
}

.lightbox-star.filled {
  color: var(--warning);
}

.lightbox-rating-count {
  font-size: 0.6rem;
  color: rgba(255,255,255,0.4);
  margin-left: 0.2rem;
}

.gallery-preview-nav {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  pointer-events: all;
}

.gallery-preview-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  transition: all 0.2s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.gallery-preview-btn:hover {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.4);
}

.gallery-preview-btn.gallery-preview-open {
  padding: 0.4rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  gap: 0.3rem;
  background: rgba(99, 102, 241, 0.6);
  border-color: rgba(99, 102, 241, 0.7);
}

.gallery-preview-btn.gallery-preview-open:hover {
  background: rgba(99, 102, 241, 0.8);
}

/* ---- Elegant Divider ---- */
.gallery-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 0;
}

/* ---- Gallery Toolbar (Search + Chips + Color Filters) ---- */
.gallery-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 2rem;
  flex-wrap: wrap;
}

.gallery-search {
  position: relative;
  flex: 0 1 320px;
  min-width: 180px;
}

.gallery-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.gallery-search input {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.45rem 0.75rem 0.45rem 2rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: inherit;
}

.gallery-search input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Tag chips - single row, no wrapping */
.gallery-tag-chips {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.filter-chip {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Color/theme filter buttons */
.gallery-color-filters {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.color-filter-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

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

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

.color-filter-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 0.15rem;
}

.color-filter-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  transition: all 0.2s;
  flex-shrink: 0;
}

.color-filter-swatch:hover {
  border-color: var(--text-primary);
  transform: scale(1.15);
}

.color-filter-swatch.active {
  border-color: #fff;
  box-shadow: 0 0 0 2px var(--accent);
  transform: scale(1.15);
}

/* Rating filter */
.gallery-rating-filter {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.rating-filter-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

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

.rating-filter-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--warning);
  color: var(--warning);
}

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  padding: 0 2rem 2rem;
}

/* Card screenshot placeholder (when no thumbnail) */
.card-preview-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-primary));
}

.card-preview-placeholder span {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  opacity: 0.6;
}

/* Gallery Lightbox */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 2000;
  display: none;
  flex-direction: column;
}

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

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.85);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 1;
}

.lightbox-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox-rating {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
}

.lightbox-star {
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--border);
  background: none;
  border: none;
  padding: 0.1rem;
  transition: color 0.15s, transform 0.15s;
  line-height: 1;
}

.lightbox-star:hover {
  transform: scale(1.2);
}

.lightbox-star.filled {
  color: var(--warning);
}

.lightbox-rating-count {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: 0.35rem;
}

.lightbox-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.lightbox-body {
  flex: 1;
  position: relative;
  display: flex;
  align-items: stretch;
}

.lightbox-body iframe {
  flex: 1;
  width: 100%;
  border: none;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.lightbox-nav:hover {
  background: rgba(99, 102, 241, 0.7);
  border-color: var(--accent);
  transform: translateY(-50%) scale(1.1);
}

.lightbox-nav-prev {
  left: 1rem;
}

.lightbox-nav-next {
  right: 1rem;
}

.lightbox-counter {
  text-align: center;
  padding: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.85);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Gallery card */
.gallery-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.2s;
}

.gallery-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.gallery-card .card-preview {
  height: 180px;
  position: relative;
  overflow: hidden;
  background: #000;
  cursor: pointer;
}

.gallery-card .card-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

.gallery-card .card-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-card.hidden {
  display: none;
}

.gallery-card .card-info {
  padding: 1rem;
}

.gallery-card .card-info h3 {
  font-size: 1rem;
  margin-bottom: 0.3rem;
}

.gallery-card .card-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.card-tag {
  font-size: 0.65rem;
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-secondary);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  border: 1px solid rgba(99, 102, 241, 0.2);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* filter chips have uniform style */

.gallery-card .card-info .card-type {
  font-size: 0.7rem;
  background: var(--bg-tertiary);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
  color: var(--accent-light);
}

.gallery-card .card-origin {
  font-size: 0.68rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.3rem;
}

.gallery-card .card-id {
  font-size: 0.68rem;
  font-family: monospace;
  color: var(--text-secondary);
  margin-top: 0.4rem;
  padding: 0.2rem 0.4rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: border-color 0.2s;
}

.gallery-card .card-id:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.gallery-card .card-id .card-id-label {
  color: var(--accent-light);
  font-weight: 600;
}

.gallery-card .card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0 1rem 0.5rem;
  flex-wrap: wrap;
}

.rating {
  display: flex;
  gap: 0.2rem;
}

.rating .star {
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--border);
  background: none;
  border: none;
  padding: 0;
}

.rating .star.filled {
  color: var(--warning);
}

/* ===================== VARIATION CARDS ===================== */
.card-variations-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.78rem;
  cursor: pointer;
  width: 100%;
  transition: color 0.2s;
  font-family: inherit;
}

.card-variations-toggle:hover {
  color: var(--accent-light);
}

.seed-toggle-icon {
  font-size: 0.65rem;
  display: inline-block;
  transition: transform 0.2s;
}

.gallery-card-child {
  border-left: 3px solid var(--accent);
}

.gallery-card-child .card-preview {
  height: 140px;
}

/* ===================== LIGHTBOX VARIATIONS PANEL ===================== */
.lightbox-variations-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  height: 100%;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: none;
  flex-direction: column;
  z-index: 10;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.lightbox-variations-panel.active {
  display: flex;
}

.variations-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.variations-panel-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-light);
}

.lightbox-variations-grid {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.variation-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.variation-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.variation-preview {
  height: 120px;
  overflow: hidden;
  background: #000;
}

.variation-preview iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none;
}

.variation-info {
  padding: 0.5rem 0.75rem;
}

.variation-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-primary);
}

.variations-loading,
.variations-empty {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-align: center;
  padding: 2rem 1rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
}

.empty-state p {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

/* ===================== PLACEHOLDER ===================== */
.preview-placeholder {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.placeholder-content {
  text-align: center;
  color: var(--text-secondary);
}

.placeholder-icon {
  font-size: 3rem;
  color: var(--border);
  margin-bottom: 0.5rem;
  font-weight: 300;
}

.placeholder-content p {
  font-size: 0.9rem;
}

/* ===================== STATUS / SAVE ===================== */
.status-msg {
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.status-msg.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-msg.success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.save-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.save-field label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.save-field input,
.save-field textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.5rem;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.9rem;
}

.save-field input:focus,
.save-field textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===================== BUILD LOADING OVERLAY ===================== */
.build-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 15, 26, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}

.build-loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

.build-loading-content {
  text-align: center;
}

.build-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

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

.build-loading-text {
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.build-loading-sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Voice button active */
.btn.voice-active {
  background: var(--danger);
  color: white;
  animation: voicePulse 1.5s infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .creator-chat-suggestions {
    display: none;
  }
  .creator-chat-right {
    width: 100%;
    min-height: 30%;
  }
  .creator-chat-panels {
    flex-direction: column;
  }
  .creator-chat-center {
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: 50%;
  }
}

@media (max-width: 768px) {
  .home-hero h2 {
    font-size: 1.4rem;
  }
  .home-actions {
    flex-direction: column;
    align-items: center;
  }
  .home-action-divider {
    width: 80%;
    height: 1px;
    margin: 0.25rem auto;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
  }
  .home-group-cards {
    flex-direction: column;
    align-items: center;
  }
  .home-action-card {
    width: 100%;
    max-width: 320px;
  }
  .workspace-view {
    flex-direction: column;
  }
  .workspace-sidebar {
    width: 100% !important;
    min-width: 0 !important;
    max-height: 45vh;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .workspace-sidebar.collapsed {
    max-height: 48px !important;
    width: 100% !important;
  }
  .workspace-sidebar.collapsed .sidebar-toggle {
    left: auto;
    right: 12px;
  }
  .sidebar-toggle {
    transform: rotate(-90deg);
  }
  .workspace-sidebar.collapsed .sidebar-toggle {
    transform: rotate(90deg);
  }
  .workspace-preview {
    min-height: 300px;
  }
  .gallery-preview-hero {
    height: 220px;
  }
  .gallery-toolbar {
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: stretch;
  }
  .gallery-search {
    flex: 1 1 auto;
    max-width: none;
  }
  .gallery-tag-chips {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .gallery-color-filters {
    flex-wrap: wrap;
  }
  .gallery-grid {
    grid-template-columns: 1fr;
    padding: 0 1rem 1rem;
  }
  .lightbox-variations-panel {
    width: 100%;
    height: 50%;
    top: auto;
    bottom: 0;
    border-left: none;
    border-top: 1px solid var(--border);
  }
  .creator-chat-modal-body {
    width: 100%;
    max-height: 95vh;
  }
  .onboarding-modal-body {
    max-width: 100%;
    width: 100%;
    border-radius: 0;
  }
  .onboarding-step {
    padding: 1.5rem 1.25rem 2rem;
  }
  .onboarding-features {
    flex-direction: column;
    align-items: center;
  }
  .onboarding-feature-card {
    width: 100%;
    max-width: 300px;
  }
  .onboarding-flow {
    flex-direction: column;
    align-items: center;
    gap: 0;
  }
  .flow-connector {
    padding: 0;
    transform: rotate(90deg);
    margin: 0.25rem 0;
  }
}

/* ===================== PERFORMANCE UI ===================== */

/* Tier selector in chat modal header */
.perf-tier-selector {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.perf-tier-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  white-space: nowrap;
}

.perf-tier-select {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
  cursor: pointer;
  outline: none;
}

.perf-tier-select:focus {
  border-color: var(--accent);
}

.perf-tier-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  white-space: nowrap;
}

.perf-tier-badge:empty {
  display: none;
}

.perf-tier-badge.tier-low {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.perf-tier-badge.tier-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.perf-tier-badge.tier-high {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Performance monitor in workspace sidebar */
.perf-monitor-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.perf-fps-display {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.perf-fps-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
  min-width: 2ch;
  text-align: right;
}

.perf-fps-value.fps-good {
  color: #4ade80;
}

.perf-fps-value.fps-warn {
  color: #fbbf24;
}

.perf-fps-value.fps-critical {
  color: #f87171;
}

.perf-fps-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.perf-tier-info {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Responsive: hide tier selector label on narrow screens */
@media (max-width: 768px) {
  .perf-tier-label {
    display: none;
  }
  .perf-tier-selector {
    gap: 0.3rem;
  }
}

/* ===================== HEADER LOGO ===================== */
.header-logo-svg {
  vertical-align: middle;
  margin-right: 0.5rem;
  position: relative;
  top: -1px;
}

/* Dark theme (default): purple logo */
.logo-mark {
  fill: var(--accent);
}
.logo-labs-text {
  fill: #ffffff;
}

/* ===================== NAV AUTH BUTTONS ===================== */
.nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}

.nav-auth-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

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

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

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

.nav-logout-btn {
  border-color: transparent;
  padding: 6px;
}

.nav-logout-btn:hover {
  color: var(--danger);
  border-color: transparent;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: var(--radius);
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-link.active {
  color: var(--accent);
  background: var(--bg-tertiary);
}

/* Theme toggle button in nav */
.theme-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  color: var(--text-secondary);
  transition: color 0.15s;
}

.theme-toggle-btn:hover {
  color: var(--text-primary);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* ===================== LIGHT THEME ===================== */
[data-theme="light"] {
  --bg-primary: #f5f7fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #eef0f4;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #4f46e5;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --border: #dde1e8;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

/* Light theme: dark logo */
[data-theme="light"] .logo-mark {
  fill: #1a1a2e;
}
[data-theme="light"] .logo-labs-text {
  fill: #ffffff;
}

[data-theme="light"] .modal-overlay {
  background: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .build-loading-overlay {
  background: rgba(245, 247, 250, 0.95);
}

[data-theme="light"] .header {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .home-action-card {
  background: rgba(255, 255, 255, 0.85);
}

/* Keep preview areas dark regardless of theme */
[data-theme="light"] .workspace-preview,
[data-theme="light"] .card-preview,
[data-theme="light"] .variation-preview {
  background: #000;
}

/* ===================== FAST START WIZARD ===================== */

.fast-start-modal-body {
  max-width: 680px;
  width: 92%;
  max-height: 92vh;
  padding: 0;
  text-align: center;
  position: relative;
  overflow-y: auto;
}

/* Progress dots */
.fs-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 1.5rem 2rem 0;
}

.fs-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  flex-shrink: 0;
}

.fs-dot.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.fs-dot.done {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.fs-dot-line {
  width: 40px;
  height: 2px;
  background: var(--border);
  flex-shrink: 0;
}

/* Steps */
.fs-step {
  display: none;
  padding: 1.5rem 2rem 2rem;
}

.fs-step.active {
  display: block;
}

.fs-step-header {
  margin-bottom: 1.5rem;
}

.fs-step-header h2 {
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  font-weight: 700;
}

.fs-step-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.fs-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.fs-btn-next {
  min-width: 120px;
}

/* Questions (Step 1) */
.fs-questions {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: left;
}

.fs-question-block {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
}

.fs-question-block label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.6rem;
}

.fs-answer-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.fs-answer-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.fs-answer-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.fs-answer-btn.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Concepts (Step 2) */
.fs-concepts {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fs-concept-card {
  background: var(--bg-primary);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.fs-concept-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.15);
}

.fs-concept-card.selected {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.06);
}

.fs-concept-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.fs-concept-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-light);
}

.fs-concept-colors {
  display: flex;
  gap: 0.25rem;
}

.fs-concept-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.fs-concept-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  line-height: 1.4;
}

.fs-concept-inspiration {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-style: italic;
  opacity: 0.7;
}

.fs-loading {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
}

.fs-loading p {
  margin-top: 1rem;
  font-size: 0.9rem;
}

/* Style Options (Step 3) */
.fs-style-options {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: left;
}

.fs-style-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.fs-option-row {
  display: flex;
  gap: 0.4rem;
}

.fs-option-btn {
  flex: 1;
  background: var(--bg-primary);
  border: 2px solid var(--border);
  color: var(--text-secondary);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.fs-option-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.fs-option-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* Reveal Card (Step 4) */
.fs-reveal-card {
  background: var(--bg-primary);
  border: 2px solid var(--accent);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: left;
}

.fs-build-btn {
  min-width: 140px;
  font-size: 1rem;
  padding: 0.6rem 1.5rem;
}

/* Featured action card on home */
.home-action-card.home-action-featured {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.08);
}

.home-action-card.home-action-featured:hover {
  background: rgba(99, 102, 241, 0.14);
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.3);
}

/* ===================== QUICK TWEAKS ===================== */
.quick-tweaks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.quick-tweak-btn {
  flex: 0 0 calc(50% - 0.2rem);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  font-weight: 500;
}

.quick-tweak-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.08);
}

.quick-tweak-btn:active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* ===================== TUNING SECTION TOGGLE ===================== */
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.section-title-row .section-title {
  margin-bottom: 0;
}

.tuning-toggle-btn {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

.tuning-field.tuning-advanced {
  display: none;
}

.tuning-controls.show-advanced .tuning-field.tuning-advanced {
  display: flex;
}

.tuning-color-row.tuning-advanced {
  display: none;
}

.tuning-controls.show-advanced .tuning-color-row.tuning-advanced {
  display: flex;
}

/* Gallery cards have uniform styling - no visual distinction between template/user */

/* ===================== PRICING VIEW ===================== */
.pricing-view {
  display: none;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 2rem;
}

.pricing-view.active {
  display: block;
}

.pricing-content {
  max-width: 1100px;
  margin: 0 auto;
}

.pricing-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.pricing-header h2 {
  font-size: 1.8rem;
  color: var(--accent-light);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.pricing-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.pricing-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s;
}

.pricing-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.pricing-card-popular {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.04);
}

.pricing-popular-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  white-space: nowrap;
}

.pricing-card-header {
  text-align: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.pricing-card-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.pricing-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.15rem;
  margin-bottom: 0.35rem;
}

.pricing-amount {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent-light);
}

.pricing-period {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pricing-deploy-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
  flex: 1;
}

.pricing-features li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  padding-left: 1.25rem;
  position: relative;
}

.pricing-features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6rem;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.pricing-cta {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.pricing-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Responsive Fast Start */
@media (max-width: 768px) {
  .fast-start-modal-body {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
    max-height: 100vh;
  }

  .fs-option-row {
    flex-direction: column;
  }

  .fs-step {
    padding: 1.25rem 1rem 1.5rem;
  }
}
