/* ============================================
   RENDERELLA WEB - Cyberpunk Neon Theme
   ============================================ */

/* --- CSS Custom Properties (Design Tokens) --- */
:root {
  /* Backgrounds */
  --bg-primary: #050507;
  --bg-secondary: #0A0A0E;
  --bg-tertiary: #101014;
  --bg-elevated: #15151A;
  --bg-card: #0D0D12;

  /* Neon Palette */
  --neon-cyan: #00F0FF;
  --neon-cyan-dim: #00B8C4;
  --neon-cyan-glow: rgba(0, 240, 255, 0.4);
  --neon-magenta: #FF2D78;
  --neon-magenta-dim: #D61F5F;
  --neon-magenta-glow: rgba(255, 45, 120, 0.4);
  --neon-blue: #00B4D8;
  --neon-blue-glow: rgba(0, 180, 216, 0.4);
  --neon-purple: #A855F7;
  --neon-purple-dim: #8B5CF6;
  --neon-purple-glow: rgba(168, 85, 247, 0.4);
  --neon-green: #10B981;
  --neon-green-dim: #059669;
  --neon-green-glow: rgba(16, 185, 129, 0.4);
  --neon-orange: #F97316;
  --neon-orange-glow: rgba(249, 115, 22, 0.4);
  --neon-yellow: #FBBF24;
  --neon-yellow-glow: rgba(251, 191, 36, 0.4);
  --neon-pink: #EC4899;
  --neon-pink-glow: rgba(236, 72, 153, 0.4);
  --neon-red: #EF4444;
  --neon-red-glow: rgba(239, 68, 68, 0.4);

  /* Text */
  --text-primary: #F5F5F5;
  --text-secondary: #C8C8D0;
  --text-tertiary: #9898A4;
  --text-disabled: #8A8A96;

  /* Status */
  --status-success: #10B981;
  --status-success-bg: rgba(16, 185, 129, 0.1);
  --status-error: #EF4444;
  --status-error-bg: rgba(239, 68, 68, 0.1);
  --status-warning: #F59E0B;
  --status-warning-bg: rgba(245, 158, 11, 0.1);

  /* Surfaces (used in admin panel, account pages) */
  --surface: var(--bg-secondary);
  --surface-alt: var(--bg-tertiary);
  --surface-hover: var(--bg-elevated);

  /* Accent (warm - used in pricing/promo) */
  --accent-warm: #FF6B35;

  /* UI */
  --border: rgba(255, 255, 255, 0.1);
  --border-active: var(--neon-cyan);
  --divider: rgba(255, 255, 255, 0.07);
  --overlay: rgba(0, 0, 0, 0.8);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-highlight: rgba(255, 255, 255, 0.08);

  /* Spacing */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-2xl: 48px;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Layout */
  --top-bar-height: 60px;
  --bottom-bar-height: 64px;
  --sidebar-width: 280px;
  --content-max-width: 1400px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* Keyboard focus indicators */
*:focus-visible { outline: 2px solid var(--neon-cyan); outline-offset: 2px; }
*:focus:not(:focus-visible) { outline: none; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* Selection */
::selection { background: rgba(0, 240, 255, 0.3); color: #fff; }

/* --- App Shell --- */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* --- Top Navigation Bar --- */
#top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--top-bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-lg);
  background: rgba(5, 5, 7, 0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-weight: 700;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.logo-img {
  height: 38px;
  width: auto;
  filter: brightness(1.15) contrast(1.3) drop-shadow(0 0 6px rgba(255, 184, 0, 0.4)) drop-shadow(0 0 12px rgba(255, 45, 120, 0.2));
}

.top-bar-center {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-out);
}

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

.nav-link.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.nav-link ion-icon {
  font-size: 1.125rem;
}

.nav-link-create {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(255, 45, 120, 0.15));
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.nav-link-create.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.25), rgba(255, 45, 120, 0.25));
  border-color: rgba(0, 240, 255, 0.4);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-out);
}

.icon-btn:hover {
  color: var(--text-primary);
  background: var(--glass);
}

.icon-btn.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(0, 240, 255, 0.18);
}

.icon-btn ion-icon {
  font-size: 1.25rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

/* --- Bottom Tab Bar (Mobile) --- */
#bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-bar-height);
  background: rgba(5, 5, 7, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--border);
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-item ion-icon {
  font-size: 1.375rem;
}

.tab-item.active {
  color: var(--neon-cyan);
}

.tab-item-create .create-btn-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-item-create .create-btn-wrap ion-icon {
  font-size: 2rem;
  color: var(--neon-cyan);
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.5));
}

.tab-item-create.active .create-btn-wrap ion-icon {
  filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.7));
}

/* --- Main Content --- */
#content {
  flex: 1;
  margin-top: var(--top-bar-height);
  padding-bottom: var(--sp-lg);
  min-height: calc(100vh - var(--top-bar-height));
  min-height: calc(100dvh - var(--top-bar-height));
}

/* --- Glass Card --- */
.glass-card {
  background: linear-gradient(135deg, var(--glass), rgba(255,255,255,0.01));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* --- Neon Button --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: #050507;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.4);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

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

.btn-secondary:hover {
  background: var(--glass-highlight);
  border-color: rgba(255,255,255,0.12);
}

.btn-ghost {
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--glass);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--neon-red);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
  padding: var(--sp-xs) var(--sp-sm);
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: var(--sp-md) var(--sp-lg);
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: var(--radius-md);
}

.btn-icon ion-icon {
  font-size: 1.25rem;
}

/* --- Neon Input --- */
.input-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.input-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.neon-input {
  width: 100%;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  outline: none;
  transition: all 0.2s var(--ease-out);
}

.neon-input:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1), 0 0 20px rgba(0, 240, 255, 0.08);
}

.neon-input::placeholder {
  color: var(--text-tertiary);
}

textarea.neon-input {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* --- Range Slider --- */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--neon-cyan);
  min-width: 3ch;
  text-align: right;
}

.neon-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--bg-elevated);
  border-radius: 2px;
  outline: none;
}

.neon-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan-glow);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.neon-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 16px var(--neon-cyan-glow);
}

.neon-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 10px var(--neon-cyan-glow);
  cursor: pointer;
  border: none;
}

/* --- Chip / Tag --- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
  padding: var(--sp-xs) var(--sp-sm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  user-select: none;
}

.chip:hover {
  background: var(--glass-highlight);
}

.chip.active {
  background: rgba(0, 240, 255, 0.12);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--neon-cyan);
}

.chip ion-icon {
  font-size: 0.875rem;
}

/* --- Select Dropdown --- */
.neon-select {
  padding: var(--sp-sm) var(--sp-md);
  padding-right: var(--sp-xl);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717A' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s var(--ease-out);
}

.neon-select:focus {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}

.neon-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s var(--ease-out);
}

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

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s var(--ease-spring);
}

.modal-overlay.open .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  padding: var(--sp-lg);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-sm);
  padding: var(--sp-md) var(--sp-lg);
  border-top: 1px solid var(--border);
}

/* --- Toast Notifications --- */
#toasts {
  position: fixed;
  bottom: 80px;
  right: var(--sp-lg);
  z-index: 3000;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--sp-sm);
  pointer-events: none;
}

.toast {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  pointer-events: auto;
  animation: toast-in 0.3s var(--ease-spring);
  max-width: 360px;
}

.toast-success {
  background: var(--status-success-bg);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--status-success);
}

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

.toast-info {
  background: rgba(0, 180, 216, 0.1);
  border: 1px solid rgba(0, 180, 216, 0.3);
  color: var(--neon-blue);
}

.toast.removing {
  animation: toast-out 0.25s var(--ease-out) forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(20px); }
}

/* --- Skeleton Loading --- */
.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-elevated) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

/* --- Spinner --- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.spinner-lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

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

/* --- Neon Glow Animation --- */
@keyframes neon-pulse {
  0%, 100% { box-shadow: 0 0 5px var(--neon-cyan-glow), 0 0 15px rgba(0, 240, 255, 0.1); }
  50% { box-shadow: 0 0 10px var(--neon-cyan-glow), 0 0 25px rgba(0, 240, 255, 0.2); }
}

/* --- Page Section Utilities --- */
.page-section {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--sp-lg);
}

.page-header {
  padding: var(--sp-xl) 0 var(--sp-lg);
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-top: var(--sp-xs);
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--sp-md);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.section-title ion-icon {
  color: var(--neon-cyan);
}

/* --- Grid Layouts --- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-md); }

/* --- Flex Utilities --- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--sp-xs); }
.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }

/* --- Spacing Utilities --- */
.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mb-sm { margin-bottom: var(--sp-sm); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }

/* --- Text Utilities --- */
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--text-tertiary); }
.text-cyan { color: var(--neon-cyan); }
.text-magenta { color: var(--neon-magenta); }
.text-mono { font-family: var(--font-mono); }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =============================================
   CREATE PAGE
   ============================================= */

.create-page {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  height: calc(100vh - var(--top-bar-height));
  height: calc(100dvh - var(--top-bar-height));
  overflow: hidden;
}

/* Template Sidebar (Left) */
.template-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  overflow: hidden;
  width: 0;
  opacity: 0;
  transition: width 0.3s var(--ease-out), opacity 0.2s ease;
}

.template-sidebar.open {
  width: 300px;
  opacity: 1;
}

.template-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.template-sidebar-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.template-sidebar-close {
  display: none;
}

.template-mobile-toggle {
  display: none;
}

.template-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  max-height: 160px;
  overflow-y: auto;
}

.template-category-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.template-category-btn ion-icon {
  font-size: 14px;
}

.template-category-btn:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.12);
}

.template-category-btn.active {
  background: var(--neon-cyan);
  background: linear-gradient(135deg, rgba(0,240,255,0.15), rgba(168,85,247,0.1));
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
}

.template-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-sm);
}

.template-subcategories {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding-bottom: var(--sp-sm);
  margin-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border);
}

.template-sub-btn {
  padding: 3px 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-size: 0.6875rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.template-sub-btn:hover {
  color: var(--text-secondary);
  border-color: rgba(255,255,255,0.1);
}

.template-sub-btn.active {
  color: var(--neon-cyan);
  border-color: rgba(0,240,255,0.3);
  background: rgba(0,240,255,0.06);
}

.template-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.template-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: var(--sp-sm) 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  width: 100%;
  color: var(--text-primary);
}

.template-card:hover {
  border-color: rgba(0,240,255,0.2);
  background: rgba(0,240,255,0.03);
  box-shadow: 0 0 12px rgba(0,240,255,0.06);
}

.template-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius-sm);
}

.template-card-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.template-card-name {
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.template-card-prompt {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.template-tag {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 600;
  opacity: 0.8;
}

/* Built-in snippet badge */
.builtin-badge {
  font-size: 0.5625rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 3px;
  padding: 1px 5px;
  margin-left: 6px;
  flex-shrink: 0;
}

.builtin-summary {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-left: 4px;
}

.builtin-snippet-item {
  opacity: 1;
}

.builtin-snippet-item:hover {
  opacity: 1;
}

.popover-section-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-disabled);
  padding: 8px 12px 4px;
}


/* Canvas / Main Image Area */
.create-canvas {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.canvas-main {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--bg-tertiary);
  margin: var(--sp-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  min-height: 300px;
}

.canvas-main img,
.canvas-main video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-md);
  transition: transform 0.2s var(--ease-out);
}

.canvas-main img { cursor: zoom-in; }

.canvas-main.generating {
  animation: neon-pulse 2s ease-in-out infinite;
}

.canvas-main.drag-over {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.05);
}

.canvas-main-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-md);
  color: var(--text-disabled);
  text-align: center;
  padding: var(--sp-xl);
}

.canvas-main-empty ion-icon {
  font-size: 3rem;
  opacity: 0.7;
}

.canvas-main-empty h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.canvas-main-empty p {
  font-size: 0.875rem;
  color: var(--text-tertiary);
}

/* Hover overlay with actions */
.canvas-main-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0,0,0,0.8));
  opacity: 0;
  transition: opacity 0.25s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--sp-md);
  pointer-events: none;
}

.canvas-main:hover .canvas-main-overlay {
  opacity: 1;
  pointer-events: auto;
}

.canvas-main-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
  max-width: 760px;
}

.canvas-main-actions .btn {
  backdrop-filter: blur(8px);
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
  min-height: 40px;
  padding: 10px 14px;
  white-space: nowrap;
}

.canvas-main-actions .btn:hover {
  background: rgba(0, 240, 255, 0.2);
  border-color: var(--neon-cyan);
}

.canvas-main-meta {
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.viewer-image-helper {
  position: fixed;
  inset: 0;
  z-index: 1200;
}

.viewer-image-helper-spotlight {
  position: fixed;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.16);
  background: transparent;
  box-shadow: 0 0 0 9999px rgba(3, 6, 12, 0.74);
  pointer-events: none;
  transition: left 0.18s ease, top 0.18s ease, width 0.18s ease, height 0.18s ease;
}

.viewer-image-helper-card {
  position: fixed;
  max-width: calc(100vw - 32px);
  padding: 18px 18px 16px;
  background: rgba(10, 13, 20, 0.94);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  z-index: 1;
}

.viewer-image-helper-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.viewer-image-helper-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  padding-right: 28px;
}

.viewer-image-helper-copy {
  margin: 0 0 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  font-size: 0.9125rem;
}

.viewer-image-helper-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
  margin-bottom: 12px;
}

.viewer-image-helper-actions .btn {
  flex: 1 1 160px;
}

.viewer-image-helper-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.viewer-image-helper-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--neon-cyan);
}

.create-page.viewer-image-helper-open .canvas-main-overlay {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Inpaint Editor */
.inpaint-editor {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  gap: var(--sp-sm);
  padding: var(--sp-sm);
}

.inpaint-editor canvas {
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  cursor: crosshair;
  flex-shrink: 0;
  touch-action: none;
}

.inpaint-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-xs) var(--sp-sm);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.inpaint-tool {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.15s;
}
.inpaint-tool:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.inpaint-tool.active { color: var(--neon-cyan); border-color: var(--neon-cyan); background: rgba(0,240,255,0.08); }

.inpaint-size {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}
.inpaint-size input[type="range"] {
  width: 80px;
  accent-color: var(--neon-cyan);
}

.inpaint-mode-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: default;
}
.inpaint-mode-badge.classic {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.25);
}
.inpaint-mode-badge.markup {
  color: var(--neon-magenta);
  background: rgba(255, 45, 120, 0.12);
  border: 1px solid rgba(255, 45, 120, 0.25);
}

.inpaint-spacer { flex: 1; }

/* Reference Strip (pinned images for prompt) */
.ref-strip {
  padding: var(--sp-xs) var(--sp-md);
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ref-strip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-xs);
}
.ref-strip-label {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--neon-cyan);
}
.ref-strip-label ion-icon { font-size: 14px; }
.ref-strip-clear {
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.ref-strip-clear:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.ref-strip-clear ion-icon { font-size: 13px; }
.ref-strip-images {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.ref-strip-item {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid var(--neon-cyan);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.15);
  cursor: pointer;
  transition: border-color 0.15s;
}
.ref-strip-item--form { border-color: var(--neon-magenta); box-shadow: 0 0 6px rgba(168, 85, 247, 0.15); }
.ref-strip-item img { width: 100%; height: 100%; display: block; object-fit: cover; }
.ref-strip-item-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  color: var(--text-primary);
  font-size: 8px;
  font-weight: 600;
  padding: 8px 2px 1px;
  text-align: center;
}
.ref-strip-item-remove {
  position: absolute;
  top: 1px;
  right: 1px;
  background: rgba(0,0,0,0.7);
  border: none;
  color: var(--text-primary);
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}
.ref-strip-item:hover .ref-strip-item-remove { opacity: 1; }

/* Thumbnail Strip */
.canvas-thumbs {
  padding: 0 var(--sp-md) var(--sp-sm);
}

.canvas-thumbs-inner {
  display: flex;
  gap: var(--sp-sm);
  overflow-x: auto;
  padding-bottom: var(--sp-xs);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.canvas-thumbs-inner::-webkit-scrollbar { height: 8px; }
.canvas-thumbs-inner::-webkit-scrollbar-track { background: rgba(255,255,255,0.03); border-radius: 4px; }
.canvas-thumbs-inner::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 4px; }
.canvas-thumbs-inner::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.3); }

.thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s var(--ease-out);
  scroll-snap-align: start;
  opacity: 0.75;
}

.thumb:hover {
  opacity: 0.95;
  border-color: rgba(255,255,255,0.15);
}

.thumb.active {
  opacity: 1;
  border-color: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Prompt Bar */
.prompt-bar {
  position: relative;
  padding: var(--sp-md);
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.prompt-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-sm);
  transition: border-color 0.2s;
}

.prompt-input-wrap:focus-within {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.08);
}

.prompt-input-wrap > .icon-btn {
  flex-shrink: 0;
  align-self: flex-end;
}

.prompt-textarea-wrap {
  flex: 1;
  position: relative;
  min-height: 24px;
}

.prompt-highlight-layer {
  position: absolute;
  inset: 0;
  padding: var(--sp-xs) var(--sp-sm);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: hidden;
  pointer-events: none;
  color: transparent;
}

.prompt-highlight-layer mark {
  color: transparent;
  background: var(--mark-bg, rgba(0,240,255,0.15));
  border-bottom: 2px solid var(--mark-color, var(--neon-cyan));
  border-radius: 3px;
  padding: 1px 2px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.prompt-textarea {
  position: relative;
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  min-height: 24px;
  max-height: 120px;
  padding: var(--sp-xs) var(--sp-sm);
}

.prompt-textarea.has-highlights {
  color: var(--text-primary);
  caret-color: var(--text-primary);
}

/* Active #tag pills strip */
.prompt-active-tags {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: var(--sp-xs) 0 0;
}

.prompt-active-tags:not(:empty) {
  display: flex;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--tag-color, var(--neon-cyan));
  border-left: 3px solid var(--tag-color, var(--neon-cyan));
  font-size: 0.75rem;
  line-height: 1.4;
}

.tag-pill-hash {
  color: var(--tag-color);
  font-family: var(--font-mono);
  font-weight: 600;
}

.tag-pill-arrow {
  color: var(--text-disabled);
  font-size: 0.625rem;
}

.tag-pill-label {
  color: var(--text-secondary);
}

.tag-pill-expand {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.6875rem;
}

.prompt-textarea::placeholder {
  color: var(--text-disabled);
}

/* Modifier Autocomplete Dropdown */
.modifier-autocomplete {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 100;
  margin-bottom: 4px;
  padding: 4px 0;
  backdrop-filter: blur(12px);
}

.modifier-ac-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  width: 100%;
  padding: 10px var(--sp-md);
  background: transparent;
  border: none;
  border-left: 4px solid transparent;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: all 0.12s ease;
  font-size: 0.875rem;
}

.modifier-ac-item:hover {
  background: rgba(255,255,255,0.06);
  border-left-color: var(--ac-color, var(--neon-cyan));
}

.modifier-ac-item.ac-active {
  background: var(--ac-color, var(--neon-cyan));
  background: linear-gradient(90deg, color-mix(in srgb, var(--ac-color, var(--neon-cyan)) 20%, transparent), transparent 70%);
  border-left-color: var(--ac-color, var(--neon-cyan));
  box-shadow: inset 0 0 20px color-mix(in srgb, var(--ac-color, var(--neon-cyan)) 8%, transparent);
}

.modifier-ac-item.ac-active .modifier-ac-tag {
  background: color-mix(in srgb, var(--ac-color, var(--neon-cyan)) 25%, transparent);
}

.modifier-ac-item.ac-active .modifier-ac-label {
  color: var(--text-primary);
}

.modifier-ac-tag {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.06);
  transition: background 0.12s;
}

.modifier-ac-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.modifier-ac-expand {
  font-size: 0.75rem;
  color: var(--text-disabled);
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: auto;
  max-width: 50%;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  flex-shrink: 0;
  align-self: flex-end;
}

.prompt-action-btn {
  min-width: 40px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: all 0.2s var(--ease-out);
  flex-shrink: 0;
}

.prompt-action-btn ion-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.prompt-action-label {
  display: inline-flex;
  align-items: center;
}

.prompt-action-label--short {
  display: none;
}

.prompt-send-btn {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: #050507;
}

.prompt-send-btn:hover,
.prompt-remix-btn:hover {
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4);
  transform: translateY(-1px);
}

.prompt-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.prompt-send-btn.generating {
  background: var(--neon-magenta);
  color: #fff;
}

.prompt-remix-btn {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: #050507;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}

@media (max-width: 980px) {
  .prompt-remix-btn .prompt-action-label--full {
    display: none;
  }

  .prompt-remix-btn .prompt-action-label--short {
    display: inline-flex;
  }
}

.gen-cost-indicator {
  display: none; font-size: 10px; font-weight: 600;
  color: var(--neon-cyan); font-family: var(--font-mono);
  white-space: nowrap; padding: 2px 6px;
  background: rgba(0,240,255,0.1); border-radius: var(--radius-full);
}

.prompt-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  margin-top: var(--sp-sm);
}

/* Right Panel / Sidebar */
.create-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-md);
  flex-shrink: 0;
}

.sidebar-tab {
  flex: 1;
  padding: var(--sp-md) var(--sp-sm);
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-bottom-color 0.2s;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.sidebar-tab:hover {
  color: var(--text-secondary);
}

.sidebar-tab.active {
  color: var(--neon-cyan);
  border-bottom-color: var(--neon-cyan);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-md);
}

.sidebar-section {
  margin-bottom: var(--sp-lg);
}

.sidebar-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-sm);
}

/* Model Selector */
.model-selector {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.model-card {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0, 240, 255, 0.15);
  user-select: none;
  -webkit-user-select: none;
}

.model-card:hover {
  background: var(--glass);
  border-color: rgba(255,255,255,0.1);
}

.model-card.selected {
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.25);
}
.model-card-disabled {
  opacity: 0.3;
  filter: grayscale(1);
  cursor: not-allowed !important;
}

.model-card > * {
  pointer-events: none;
}

.model-card > button {
  pointer-events: auto;
}

.model-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

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

.model-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-desc {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

.model-speed {
  font-size: 0.625rem;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.speed-fast { background: rgba(16, 185, 129, 0.15); color: var(--neon-green); }
.speed-medium { background: rgba(251, 191, 36, 0.15); color: var(--neon-yellow); }
.speed-slow { background: rgba(249, 115, 22, 0.15); color: var(--neon-orange); }
.model-cost-badge {
  font-size: 0.625rem; padding: 2px 6px;
  border-radius: var(--radius-full); font-weight: 600;
  background: rgba(0,240,255,0.12); color: var(--neon-cyan);
  font-family: var(--font-mono); white-space: nowrap;
}

/* Image Tools Panel */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-sm);
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xs);
  padding: var(--sp-md) var(--sp-sm);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s var(--ease-out);
}

.tool-btn ion-icon {
  font-size: 1.25rem;
}

.tool-btn:hover {
  background: var(--glass-highlight);
  border-color: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Aspect Ratio Selector */
.aspect-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
}

.aspect-btn {
  padding: var(--sp-xs) var(--sp-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all 0.15s;
}

.aspect-btn:hover {
  border-color: rgba(255,255,255,0.12);
  color: var(--text-primary);
}

.aspect-btn.active {
  background: rgba(0, 240, 255, 0.1);
  border-color: rgba(0, 240, 255, 0.3);
  color: var(--neon-cyan);
}

/* Generation Progress */
.gen-progress {
  display: none;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.gen-progress.active {
  display: flex;
}

.gen-progress-bar {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.gen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-magenta));
  border-radius: 2px;
  transition: width 0.3s var(--ease-out);
  width: 0%;
}

.gen-progress-fill.indeterminate {
  width: 30%;
  animation: progress-slide 1.5s ease-in-out infinite;
}

@keyframes progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(400%); }
}

.gen-progress-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
}

.gen-error-notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  background: rgba(255, 45, 120, 0.08);
  border: 1px solid rgba(255, 45, 120, 0.25);
  border-radius: var(--radius-md);
  margin-top: var(--sp-xs);
  animation: gen-error-in 0.3s var(--ease-out);
}

@keyframes gen-error-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.gen-error-icon {
  color: var(--neon-magenta);
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

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

.gen-error-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--neon-magenta);
  margin-bottom: 2px;
}

.gen-error-msg {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  word-break: break-word;
}

.gen-error-dismiss {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 2px;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}

.gen-error-dismiss:hover {
  color: var(--text-primary);
}

/* =============================================
   PLAYGROUND PAGE (Pinterest for AI Art)
   ============================================= */

.playground-page {
  padding-top: var(--sp-lg);
}

/* Hero */
.pg-hero {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-lg) var(--sp-lg);
}

.pg-hero h1 {
  font-size: 2.25rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--sp-xs);
}

.pg-hero p {
  color: var(--text-secondary);
  max-width: 480px;
  margin: 0 auto;
}

/* Discover Banner (playground CTA) */
.discover-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  max-width: 520px;
  margin: 0 auto var(--sp-xl);
  padding: var(--sp-md) var(--sp-lg);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at top left, rgba(0, 240, 255, 0.08), transparent 60%),
    var(--bg-tertiary);
  border: 1px solid var(--glass-border);
  text-decoration: none;
  transition: all 0.2s var(--ease-out);
}

.discover-banner:hover {
  border-color: rgba(0, 240, 255, 0.3);
  background:
    radial-gradient(ellipse at top left, rgba(0, 240, 255, 0.12), transparent 60%),
    var(--bg-tertiary);
  transform: translateY(-1px);
}

.discover-banner-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: rgba(0, 240, 255, 0.1);
  color: var(--neon-cyan);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.discover-banner-copy {
  flex: 1;
  min-width: 0;
}

.discover-banner-copy strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.discover-banner-copy span {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

.discover-banner-arrow {
  color: var(--text-disabled);
  font-size: 1.1rem;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.discover-banner:hover .discover-banner-arrow {
  color: var(--neon-cyan);
  transform: translateX(2px);
}

.pg-mode-tabs {
  display: flex;
  justify-content: center;
  gap: var(--sp-xs);
  padding: 0 var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.pg-mode-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid transparent;
  background: var(--bg-card);
  transition: all 0.15s;
}

.pg-mode-tab:hover {
  color: var(--text-primary);
  border-color: var(--glass-border);
}

.pg-mode-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.2);
}

/* Filter Tabs */
.pg-tabs {
  display: flex;
  gap: var(--sp-xs);
  padding: 0 var(--sp-lg);
  margin-bottom: var(--sp-lg);
  justify-content: center;
}

.pg-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.15s;
}

.pg-tab:hover {
  color: var(--text-primary);
  background: var(--glass);
}

.pg-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.2);
}

/* Masonry Grid */
.pg-masonry {
  columns: 4;
  column-gap: var(--sp-md);
  padding: 0 var(--sp-lg);
  margin-bottom: var(--sp-2xl);
}

/* Cards */
.pg-card {
  break-inside: avoid;
  margin-bottom: var(--sp-md);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 0.2s var(--ease-out);
  content-visibility: auto;
}

.pg-masonry > .pg-card:nth-child(6n + 2) { margin-top: 10px; }
.pg-masonry > .pg-card:nth-child(6n + 3) { margin-top: 18px; }
.pg-masonry > .pg-card:nth-child(6n + 4) { margin-top: 6px; }
.pg-masonry > .pg-card:nth-child(6n + 5) { margin-top: 14px; }

@media (min-width: 1025px) {
  .pg-masonry > .pg-card:nth-child(n) {
    margin-top: 0;
  }

  .pg-masonry > .pg-card:nth-child(12n + 2) { margin-top: 24px; }
  .pg-masonry > .pg-card:nth-child(12n + 3) { margin-top: 78px; }
  .pg-masonry > .pg-card:nth-child(12n + 4) { margin-top: 16px; }
  .pg-masonry > .pg-card:nth-child(12n + 5) { margin-top: 92px; }
  .pg-masonry > .pg-card:nth-child(12n + 6) { margin-top: 42px; }
  .pg-masonry > .pg-card:nth-child(12n + 7) { margin-top: 10px; }
  .pg-masonry > .pg-card:nth-child(12n + 8) { margin-top: 70px; }
  .pg-masonry > .pg-card:nth-child(12n + 9) { margin-top: 28px; }
  .pg-masonry > .pg-card:nth-child(12n + 10) { margin-top: 96px; }
  .pg-masonry > .pg-card:nth-child(12n + 11) { margin-top: 18px; }
  .pg-masonry > .pg-card:nth-child(12n + 12) { margin-top: 56px; }
}

.pg-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
}

.pg-card--image,
.pg-card--pipeline {
  aspect-ratio: 1 / 1;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.06), transparent 40%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--bg-card);
}

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

.media-fade {
  opacity: 0;
  transition: opacity 0.24s ease-out, transform 0.24s ease-out;
  transform: scale(1.01);
  will-change: opacity;
}

.media-fade.is-loaded {
  opacity: 1;
  transform: none;
}

/* Card Overlay (always visible, stronger on hover) */
.pg-card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--sp-md);
  background: linear-gradient(to top, rgba(0,0,0,0.65) 0%, rgba(0,0,0,0.25) 50%, transparent 100%);
  opacity: 1;
  transition: background 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.pg-card:hover .pg-card-overlay {
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
}

.pg-card-prompt {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--sp-xs);
}

.pg-card-actions {
  display: flex;
  gap: var(--sp-xs);
}

/* Image Card View Overlay (minimal hover icon) */
.pg-card-overlay--view {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.2s;
}

.pg-card-overlay--view ion-icon {
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.9);
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

.pg-card:hover .pg-card-overlay--view {
  opacity: 1;
}

/* Detail Action Grid */
.pg-detail-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-sm);
}

.pg-detail-action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: var(--sp-md) var(--sp-sm);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

.pg-detail-action-btn:hover {
  background: var(--glass);
  color: var(--text-primary);
  border-color: rgba(255,255,255,0.1);
}

.pg-detail-action-btn ion-icon {
  font-size: 1.25rem;
}

/* Pipeline Card Variant */
.pg-card--pipeline {
  border-color: rgba(168, 85, 247, 0.2);
}

.pg-card--pipeline:hover {
  border-color: rgba(168, 85, 247, 0.4);
  box-shadow: 0 12px 32px rgba(168, 85, 247, 0.15);
}

.pg-card-pipeline-badge {
  position: absolute;
  top: var(--sp-sm);
  left: var(--sp-sm);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(168, 85, 247, 0.85);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
  z-index: 1;
}

.pg-card-overlay--pipeline {
  background: linear-gradient(to top, rgba(30, 10, 60, 0.9) 0%, rgba(30, 10, 60, 0.5) 60%, transparent 100%);
}

.pg-card-pipeline-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

/* Section Titles */
.pg-section {
  padding: 0 var(--sp-lg);
  margin-bottom: var(--sp-2xl);
}

.pg-section-title {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--sp-md);
  color: var(--text-primary);
}

.pg-section-title ion-icon {
  color: var(--neon-cyan);
}

.pg-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
}

.pg-section-subtitle {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
  max-width: 620px;
}

.pg-section--spotlight {
  margin-bottom: var(--sp-xl);
}

.pg-community-link {
  flex-shrink: 0;
}

.pg-community-spotlight {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 280px);
  gap: var(--sp-md);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding-bottom: var(--sp-lg);
  scrollbar-width: auto;
  scrollbar-color: var(--neon-cyan-dim) rgba(255, 255, 255, 0.04);
}

.pg-community-spotlight::-webkit-scrollbar {
  height: 10px;
}

.pg-community-spotlight::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 5px;
  margin: 0 var(--sp-xs);
}

.pg-community-spotlight::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--neon-cyan-dim), var(--neon-purple-dim));
  border-radius: 5px;
  border: 2px solid rgba(5, 5, 7, 0.6);
}

.pg-community-spotlight::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple));
  box-shadow: 0 0 8px var(--neon-cyan-glow);
}

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

.pg-community-spotlight-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.pg-community-spotlight-media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--bg-tertiary);
}

.pg-community-spotlight-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pg-community-spotlight-badge {
  position: absolute;
  top: var(--sp-sm);
  left: var(--sp-sm);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: rgba(5, 5, 7, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  backdrop-filter: blur(10px);
}

.pg-community-spotlight-body {
  padding: var(--sp-md);
}

.pg-community-spotlight-prompt {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.6em;
}

.pg-community-spotlight-meta {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-sm);
  margin-top: var(--sp-sm);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.pg-community-spotlight-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  min-height: 200px;
  width: 100%;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.pg-community-spotlight-empty ion-icon {
  font-size: 1.5rem;
  color: var(--text-tertiary);
}

.pg-community-content-tabs {
  display: flex;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
}

.pg-community-content-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid transparent;
  background: var(--bg-card);
  transition: all 0.15s;
}

.pg-community-content-tab:hover {
  color: var(--text-primary);
  border-color: var(--glass-border);
}

.pg-community-content-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.2);
}

.pg-community-pipeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--sp-md);
}

.pg-community-pipeline-card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid rgba(168, 85, 247, 0.18);
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}

.pg-community-pipeline-card:hover {
  transform: translateY(-2px);
  border-color: rgba(168, 85, 247, 0.36);
  box-shadow: 0 14px 32px rgba(40, 18, 80, 0.28);
}

.pg-community-pipeline-media {
  aspect-ratio: 16 / 10;
  background:
    radial-gradient(circle at top left, rgba(0, 240, 255, 0.12), transparent 34%),
    linear-gradient(135deg, rgba(168, 85, 247, 0.16), rgba(0, 240, 255, 0.08)),
    var(--bg-tertiary);
  overflow: hidden;
}

.pg-community-pipeline-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pg-community-pipeline-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-community-pipeline-placeholder ion-icon {
  font-size: 2.5rem;
  color: var(--neon-cyan);
}

.pg-community-pipeline-body {
  flex: 1;
  padding: var(--sp-md);
}

.pg-community-pipeline-top {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--sp-sm);
}

.pg-community-pipeline-top strong {
  color: var(--text-primary);
  font-size: 0.95rem;
}

.pg-community-pipeline-top span,
.pg-community-pipeline-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.pg-community-pipeline-body p {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin: 0 0 var(--sp-sm);
}

.pg-community-pipeline-meta {
  display: flex;
  gap: var(--sp-sm);
  flex-wrap: wrap;
}

.pg-community-pipeline-actions {
  display: flex;
  gap: var(--sp-sm);
  padding: 0 var(--sp-md) var(--sp-md);
}

.pg-community-pipeline-actions .btn {
  flex: 1;
  justify-content: center;
}

/* Image Detail Overlay */
.pg-image-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
}

.pg-image-overlay.open {
  display: flex;
}

.pg-image-detail {
  display: flex;
  width: min(92vw, 1100px);
  max-height: min(85vh, 800px);
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.pg-image-detail-img {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  overflow: hidden;
}

.pg-image-detail-img img,
.pg-image-detail-img video {
  max-width: 100%;
  max-height: min(85vh, 800px);
  object-fit: contain;
}

.pg-image-detail-sidebar {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.pg-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pg-detail-body {
  padding: var(--sp-md);
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.pg-detail-actions {
  display: flex;
  gap: var(--sp-sm);
  flex-shrink: 0;
  padding: var(--sp-md);
  border-top: 1px solid var(--border);
}

/* =============================================
   PIPELINE FLOW
   ============================================= */

.pipeline-flow {
  min-height: calc(100vh - var(--top-bar-height));
  min-height: calc(100dvh - var(--top-bar-height));
}

.pipeline-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) var(--sp-lg);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  position: sticky;
  top: var(--top-bar-height);
  z-index: 10;
}

.pipeline-flow-header h2 {
  font-size: 1.125rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--neon-purple), var(--neon-cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.pipeline-flow-body {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}

.pipeline-flow-desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: var(--sp-xl);
  text-align: center;
}

/* Pipeline Slots */
.pipeline-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.pipeline-slot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.pipeline-slot-preview {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  transition: border-color 0.2s;
}

.pipeline-slot-preview:hover {
  border-color: var(--neon-purple-dim);
}

.pipeline-slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pipeline-slot-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-lg);
  cursor: pointer;
  text-align: center;
  color: var(--text-tertiary);
  transition: color 0.2s;
  width: 100%;
  height: 100%;
  justify-content: center;
}

.pipeline-slot-empty:hover {
  color: var(--neon-purple);
}

.pipeline-slot-empty ion-icon {
  font-size: 2.5rem;
}

.pipeline-slot-empty span {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pipeline-slot-empty small {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.pipeline-slot-actions {
  display: flex;
  gap: var(--sp-xs);
  justify-content: center;
}

/* Base Image Picker */
.pipeline-picker {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-md);
  margin-bottom: var(--sp-lg);
}

.pipeline-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-md);
  font-size: 0.875rem;
  font-weight: 600;
}

.pipeline-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: var(--sp-sm);
  max-height: 320px;
  overflow-y: auto;
}

.pipeline-picker-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border-radius: var(--radius-md);
  padding: var(--sp-xs);
  transition: background 0.15s;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
}

.pipeline-picker-item:hover {
  background: var(--glass);
}

.pipeline-picker-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.pipeline-picker-item span {
  font-size: 0.6875rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Pipeline Controls */
.pipeline-controls {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
}

.pipeline-model-row {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  flex: 1;
  min-width: 200px;
}

.pipeline-model-row label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.pipeline-model-row .neon-select {
  flex: 1;
}

.pipeline-cost {
  font-size: 0.75rem;
  color: var(--neon-cyan);
  font-weight: 600;
  white-space: nowrap;
}

.pipeline-cost--byok {
  color: var(--neon-green);
}

.pipeline-generate-btn {
  white-space: nowrap;
}

/* Pipeline Progress */
.pipeline-progress {
  text-align: center;
  padding: var(--sp-lg);
}

.pipeline-progress-text {
  display: block;
  margin-top: var(--sp-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Pipeline Result */
.pipeline-result {
  text-align: center;
  padding: var(--sp-lg) 0;
}

.pipeline-result img {
  max-width: 100%;
  max-height: 60vh;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  margin-bottom: var(--sp-md);
}

.pipeline-result-actions {
  display: flex;
  gap: var(--sp-sm);
  justify-content: center;
  flex-wrap: wrap;
}

.pipeline-picker-item--source {
  border: 1px solid transparent;
}

.pipeline-picker-item--source:hover {
  border-color: rgba(0, 240, 255, 0.24);
}

.pipeline-picker-grid--modal {
  max-height: 420px;
}

.pipeline-picker-item-placeholder {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.04);
  color: var(--text-tertiary);
}

.pipeline-picker-empty {
  grid-column: 1 / -1;
  padding: var(--sp-lg);
  text-align: center;
  color: var(--text-tertiary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.pipeline-image-picker {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.pipeline-image-picker-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.active-pipeline-strip {
  margin: 0 var(--sp-lg) var(--sp-md);
  padding: var(--sp-md);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 240, 255, 0.18);
  background:
    linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(255, 45, 120, 0.06)),
    rgba(13, 13, 18, 0.92);
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.active-pipeline-strip-header,
.active-pipeline-strip-actions,
.active-pipeline-slot-actions,
.pipeline-page-actions,
.pipeline-editor-header-actions,
.pipeline-stat-row,
.pipeline-chip-row,
.pipeline-step-actions,
.pipeline-tools-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.active-pipeline-strip-header {
  align-items: center;
  justify-content: space-between;
}

.active-pipeline-strip-title {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  font-weight: 700;
}

.active-pipeline-strip-title ion-icon,
.pipeline-editor-kicker,
.pipeline-browser-group-title {
  color: var(--neon-cyan);
}

.active-pipeline-strip-desc,
.active-pipeline-strip-meta {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.active-pipeline-strip-slots {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-md);
}

.active-pipeline-slot,
.pipeline-runtime-card,
.pipeline-runtime-editor,
.pipeline-source-card,
.create-pipeline-card,
.pipeline-browser-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.03);
}

.active-pipeline-slot {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-sm);
}

.active-pipeline-slot--auto {
  border-color: rgba(0, 240, 255, 0.18);
}

.active-pipeline-slot-preview {
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.active-pipeline-slot-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.active-pipeline-slot-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.active-pipeline-slot-copy strong,
.pipeline-runtime-label,
.pipeline-source-copy strong {
  font-size: 0.875rem;
}

.active-pipeline-slot-copy span,
.pipeline-runtime-card span,
.pipeline-source-copy span,
.create-pipeline-card-copy span,
.pipeline-browser-card-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.active-pipeline-slot-empty,
.pipeline-source-empty {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  text-align: center;
  color: var(--text-tertiary);
  padding: var(--sp-md);
}

.active-pipeline-slot-empty ion-icon,
.pipeline-source-empty ion-icon,
.pipeline-editor-empty ion-icon {
  font-size: 2rem;
}

.tools-grid--pipelines {
  margin-bottom: var(--sp-sm);
}

.pipeline-tools-footer {
  flex-direction: column;
}

.tool-btn.active {
  border-color: rgba(0, 240, 255, 0.35);
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.tool-btn--empty {
  cursor: default;
  opacity: 0.8;
}

.create-pipeline-picker {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.create-pipeline-picker-section h4 {
  margin-bottom: var(--sp-sm);
  font-size: 0.9375rem;
}

.create-pipeline-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--sp-sm);
}

.create-pipeline-picker-empty,
.pipeline-browser-empty {
  padding: var(--sp-md);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
  color: var(--text-tertiary);
}

.create-pipeline-card {
  display: flex;
  gap: var(--sp-sm);
  align-items: flex-start;
  padding: var(--sp-md);
  text-align: left;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}

.create-pipeline-card:hover,
.pipeline-browser-card:hover {
  border-color: rgba(0, 240, 255, 0.28);
  transform: translateY(-1px);
}

.create-pipeline-card.active {
  border-color: rgba(0, 240, 255, 0.42);
  background: rgba(0, 240, 255, 0.08);
}

.create-pipeline-card-icon,
.pipeline-browser-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.14), rgba(168, 85, 247, 0.14));
  color: var(--neon-cyan);
  flex-shrink: 0;
}

.create-pipeline-card-copy,
.pipeline-browser-card-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.create-pipeline-card-copy p,
.pipeline-browser-card-body p,
.pipeline-runtime-card p,
.pipeline-editor-empty p,
.pipeline-editor-header p,
.pipeline-section-header p {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.pipelines-page {
  padding: var(--sp-lg) 0 var(--sp-2xl);
}

.pipeline-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-lg);
}

.pipeline-workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: var(--sp-lg);
  align-items: start;
}

.pipeline-browser-pane,
.pipeline-editor-card,
.pipeline-editor-empty {
  padding: var(--sp-lg);
}

.pipeline-browser-pane {
  position: sticky;
  top: calc(var(--top-bar-height) + var(--sp-lg));
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.pipeline-browser-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.pipeline-browser-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pipeline-browser-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}

.pipeline-browser-card {
  display: flex;
  gap: var(--sp-sm);
  padding: var(--sp-md);
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.pipeline-browser-card.active {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.08);
}

.pipeline-browser-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
}

.pipeline-browser-card-top span {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.pipeline-editor-pane {
  min-width: 0;
}

.pipeline-editor-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-sm);
  min-height: 420px;
  text-align: center;
}

.pipeline-editor-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.pipeline-editor-header,
.pipeline-section-header,
.pipeline-step-header,
.pipeline-editor-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
}

.pipeline-editor-kicker {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}

.pipeline-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-md);
}

.pipeline-form-grid-wide {
  grid-column: 1 / -1;
}

.pipeline-inline-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-md);
}

.pipeline-share-link {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
  margin-top: var(--sp-md);
}

.pipeline-share-link .neon-input {
  flex: 1;
}

.pipeline-check {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.pipeline-check input {
  accent-color: var(--neon-cyan);
}

.pipeline-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--sp-sm);
}

.pipeline-showcase-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg-tertiary);
}

.pipeline-showcase-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pipeline-showcase-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  padding: 2px 6px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #000;
  background: var(--neon-cyan);
  border-radius: var(--radius-full);
}

.pipeline-showcase-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.pipeline-showcase-card:hover .pipeline-showcase-actions {
  opacity: 1;
}

.pipeline-showcase-actions .icon-btn {
  background: rgba(0,0,0,0.6);
  color: #fff;
  backdrop-filter: blur(4px);
}

.pipeline-showcase-caption-input {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  font-size: 0.65rem;
  padding: 4px 6px;
  background: rgba(0,0,0,0.6);
  border: none;
  color: var(--text-secondary);
  backdrop-filter: blur(4px);
}

.pipeline-editor-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.pipeline-runtime-list,
.pipeline-runtime-editor-list,
.pipeline-step-stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.pipeline-runtime-card,
.pipeline-runtime-editor,
.pipeline-step-card {
  padding: var(--sp-md);
}

.pipeline-runtime-editor {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-md);
  align-items: end;
}

.pipeline-step-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.pipeline-step-card--readonly {
  background: rgba(255,255,255,0.02);
}

.pipeline-step-model {
  color: var(--neon-cyan);
  font-size: 0.8125rem;
  font-weight: 600;
}

.pipeline-source-grid,
.pipeline-step-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-md);
}

.pipeline-source-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  padding: var(--sp-sm);
  transition: border-color 0.15s, background 0.15s;
}

.pipeline-source-card.active {
  border-color: rgba(0, 240, 255, 0.32);
  background: rgba(0, 240, 255, 0.06);
}

.pipeline-source-preview {
  width: 100%;
  aspect-ratio: 1.1;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.pipeline-source-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pipeline-source-preview--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 1.5rem;
}

.pipeline-source-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pipeline-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
}

.pipeline-step-prompt {
  white-space: pre-wrap;
  line-height: 1.6;
  color: var(--text-secondary);
  padding: var(--sp-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
}

@media (max-width: 1024px) {
  .pipeline-workspace {
    grid-template-columns: 1fr;
  }

  .pipeline-browser-pane {
    position: static;
  }

  .pipeline-runtime-editor,
  .pipeline-source-grid,
  .pipeline-step-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .pg-section-heading,
  .pg-community-pipeline-actions,
  .pipeline-share-link {
    flex-direction: column;
    align-items: stretch;
  }

  .pg-community-spotlight {
    grid-auto-columns: minmax(220px, 78vw);
  }

  .active-pipeline-strip {
    margin: 0 var(--sp-md) var(--sp-md);
  }

  .active-pipeline-strip-header,
  .pipeline-page-header,
  .pipeline-editor-header,
  .pipeline-section-header,
  .pipeline-editor-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .active-pipeline-strip-slots,
  .create-pipeline-picker-grid,
  .pipeline-form-grid,
  .pipeline-runtime-editor,
  .pipeline-source-grid,
  .pipeline-step-controls {
    grid-template-columns: 1fr;
  }

  .pipeline-browser-pane,
  .pipeline-editor-card,
  .pipeline-editor-empty {
    padding: var(--sp-md);
  }
}

/* Legacy compat: keep explore-page mapped */
.explore-page { padding-top: var(--sp-lg); }
.explore-hero { text-align: center; padding: var(--sp-2xl) var(--sp-lg); margin-bottom: var(--sp-xl); }
.explore-hero h1 {
  font-size: 2rem; font-weight: 700;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple), var(--neon-magenta));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: var(--sp-sm);
}
.explore-hero p { color: var(--text-secondary); max-width: 480px; margin: 0 auto; }

/* Category Cards */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--sp-md);
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-lg) var(--sp-md);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  text-align: center;
}

.category-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.category-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.category-card .category-name {
  font-size: 0.8125rem;
  font-weight: 600;
}

.category-card .category-desc {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* Style Cards */
.style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: var(--sp-sm);
}

.style-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-xs);
  padding: var(--sp-md) var(--sp-sm);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  text-align: center;
}

.style-card:hover {
  transform: translateY(-1px);
  border-color: rgba(255,255,255,0.1);
}

.style-card.selected {
  border-color: var(--neon-cyan);
  box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.15);
}

.style-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.125rem;
}

.style-card .style-name {
  font-size: 0.6875rem;
  font-weight: 600;
}

/* Try-This Prompt Cards */
.prompt-scroll {
  display: flex;
  gap: var(--sp-md);
  overflow-x: auto;
  padding-bottom: var(--sp-sm);
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.prompt-scroll::-webkit-scrollbar { height: 4px; }

.prompt-card {
  flex-shrink: 0;
  width: 280px;
  scroll-snap-align: start;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.prompt-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.prompt-card-preview {
  height: 160px;
  background: var(--bg-tertiary);
  position: relative;
  overflow: hidden;
}

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

.prompt-card-body {
  padding: var(--sp-md);
}

.prompt-card-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.prompt-card-meta {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  margin-top: var(--sp-sm);
  font-size: 0.6875rem;
  color: var(--text-tertiary);
}

/* =============================================
   GALLERY PAGE (Community)
   ============================================= */

.gallery-page {
  padding-top: var(--sp-lg);
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  margin-bottom: var(--sp-lg);
  flex-wrap: wrap;
}

.gallery-sort-tabs {
  display: flex;
  gap: var(--sp-xs);
}

.sort-tab {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.15s;
}

.sort-tab:hover {
  color: var(--text-primary);
  background: var(--glass);
}

.sort-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.2);
}

/* Masonry Gallery Grid */
.gallery-grid {
  columns: 4;
  column-gap: var(--sp-md);
}

.gallery-item {
  break-inside: avoid;
  margin-bottom: var(--sp-md);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  content-visibility: auto;
}

.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.08);
}

.gallery-item-expired {
  opacity: 0.5;
  cursor: default;
}
.gallery-item-expired:hover {
  transform: none;
  box-shadow: none;
}

.gallery-item-img {
  width: 100%;
  display: block;
}

.gallery-item-img.img-broken {
  aspect-ratio: 1;
  background: var(--bg-tertiary);
  position: relative;
}

.img-broken-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 0.75rem;
  gap: 0.25rem;
  flex-direction: column;
  opacity: 0.5;
}

.img-broken-label ion-icon {
  font-size: 1.5rem;
}

.gallery-item-info {
  padding: var(--sp-sm) var(--sp-md);
}

.gallery-item-prompt {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-item-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-xs) var(--sp-md) var(--sp-sm);
}

.gallery-item-votes {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.vote-btn {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  transition: color 0.15s;
}

.vote-btn:hover { color: var(--text-primary); }
.vote-btn.upvoted { color: var(--neon-cyan); }
.vote-btn.downvoted { color: var(--neon-red); }
.favorite-btn--active { color: var(--neon-pink); }
.gallery-save-btn { padding-left: 2px; }

.vote-btn ion-icon {
  font-size: 1rem;
}

.gallery-item-model {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

/* Gallery Detail Overlay */
.gallery-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0,0,0,0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s var(--ease-out);
}

.gallery-detail-overlay.open {
  opacity: 1;
  visibility: visible;
}

.gallery-detail {
  display: grid;
  grid-template-columns: 1fr 380px;
  width: 100%;
  max-width: 1200px;
  margin: auto;
  height: 90vh;
}

.gallery-detail-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-lg);
}

.gallery-detail-image img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  object-fit: contain;
}

.gallery-detail-sidebar {
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gallery-detail-header {
  padding: var(--sp-lg);
  border-bottom: 1px solid var(--border);
}

.gallery-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-lg);
}

/* =============================================
   DISCOVER PAGE (StumbleUpon for AI Art)
   ============================================= */

.discover-page {
  position: fixed;
  inset: 0;
  top: var(--top-bar-height);
  z-index: 50;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.discover-card {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  transition: opacity 0.2s ease;
}

.discover-card--loading {
  opacity: 0.4;
}

.discover-media {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.discover-media img,
.discover-media video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
}

.discover-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* Prompt drawer */
.discover-drawer {
  position: absolute;
  bottom: 80px;
  left: 0;
  right: 0;
  background: rgba(5, 5, 7, 0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-top: 1px solid var(--glass-border);
  transition: transform 0.25s var(--ease-out);
  transform: translateY(calc(100% - 40px));
  z-index: 60;
}

.discover-drawer--open {
  transform: translateY(0);
}

.discover-drawer-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px var(--sp-lg);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.discover-drawer-toggle ion-icon {
  font-size: 1rem;
  transition: transform 0.2s;
}

.discover-drawer--open .discover-drawer-toggle ion-icon {
  transform: rotate(180deg);
}

.discover-drawer-body {
  padding: 0 var(--sp-lg) var(--sp-lg);
  max-height: 200px;
  overflow-y: auto;
}

.discover-prompt {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: var(--sp-sm);
  word-break: break-word;
}

.discover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-sm);
}

.discover-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.discover-meta-item ion-icon {
  font-size: 0.8rem;
}

/* Floating action bar */
.discover-actions {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  padding-bottom: calc(var(--sp-md) + env(safe-area-inset-bottom, 0));
  background: linear-gradient(transparent, rgba(5, 5, 7, 0.95));
  z-index: 70;
}

.discover-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.15s;
  cursor: pointer;
}

.discover-action-btn:hover {
  background: var(--glass-highlight);
  border-color: rgba(255, 255, 255, 0.2);
}

.discover-action-btn ion-icon {
  font-size: 1.15rem;
}

/* Heart button */
.discover-btn-heart--active {
  color: var(--neon-pink);
  border-color: rgba(255, 45, 120, 0.3);
  background: rgba(255, 45, 120, 0.1);
}

.discover-btn-heart--pop {
  animation: discover-heart-pop 0.4s ease;
}

@keyframes discover-heart-pop {
  0% { transform: scale(1); }
  30% { transform: scale(1.3); }
  60% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

.discover-heart-count {
  font-size: 0.75rem;
  min-width: 0;
}

/* Next button gets primary treatment */
.discover-btn-next {
  background: var(--neon-cyan);
  color: #000;
  border-color: var(--neon-cyan);
  padding: 10px 24px;
}

.discover-btn-next:hover {
  background: var(--neon-cyan-dim);
  border-color: var(--neon-cyan-dim);
}

.discover-btn-open {
  padding: 10px 14px;
}

/* Counter */
.discover-counter {
  position: absolute;
  top: var(--sp-md);
  right: var(--sp-lg);
  font-size: 0.6875rem;
  color: var(--text-disabled);
  font-family: var(--font-mono);
  z-index: 60;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .discover-page {
    bottom: var(--bottom-bar-height);
  }

  .discover-actions {
    padding-bottom: var(--sp-md);
    gap: var(--sp-sm);
  }

  .discover-action-btn {
    padding: 10px 14px;
    font-size: 0.75rem;
  }

  .discover-btn-next {
    padding: 10px 20px;
  }

  .discover-drawer {
    bottom: 68px;
  }
}

/* =============================================
   LIBRARY PAGE
   ============================================= */

.library-page {
  padding-top: var(--sp-lg);
}

.library-tabs {
  display: flex;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-lg);
}

.library-tab {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all 0.15s;
}

.library-tab:hover {
  color: var(--text-primary);
  background: var(--glass);
}

.library-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
  border-color: rgba(0, 240, 255, 0.2);
}

/* Collection Bar */
.collection-bar {
  margin-bottom: var(--sp-md);
}
.collection-pills {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  -webkit-overflow-scrolling: touch;
}
.collection-pills::-webkit-scrollbar { height: 4px; }
.collection-pills::-webkit-scrollbar-track { background: transparent; }
.collection-pills::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.collection-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 0.15s;
  cursor: pointer;
  flex-shrink: 0;
}
.collection-pill:hover {
  color: var(--text-primary);
  border-color: var(--text-tertiary);
}
.collection-pill.active {
  color: var(--pill-color, var(--neon-cyan));
  background: color-mix(in srgb, var(--pill-color, var(--neon-cyan)) 10%, transparent);
  border-color: color-mix(in srgb, var(--pill-color, var(--neon-cyan)) 30%, transparent);
}
.collection-pill .collection-emoji {
  font-size: 0.85rem;
  line-height: 1;
}
.collection-pill .collection-count {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  opacity: 0.6;
  margin-left: 2px;
}
.collection-pill-add {
  padding: 6px 10px;
  color: var(--text-tertiary);
  border-style: dashed;
}
.collection-pill-add:hover {
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
}

/* Collection Badges on Gallery Items */
.gallery-item-collections {
  position: absolute;
  top: 6px;
  left: 6px;
  display: flex;
  gap: 3px;
  z-index: 2;
}
.gallery-item { position: relative; }
.gallery-coll-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  font-size: 0.65rem;
  border: 1px solid color-mix(in srgb, var(--badge-color) 40%, transparent);
  line-height: 1;
}

/* Collection Picker Popover */
.collection-picker-popover {
  position: fixed;
  z-index: 1000;
  width: 220px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  overflow: hidden;
}
.collection-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.collection-picker-header .icon-btn {
  width: 24px;
  height: 24px;
  font-size: 0.85rem;
}
.collection-picker-list {
  max-height: 200px;
  overflow-y: auto;
}
.collection-picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: background 0.1s;
  text-align: left;
}
.collection-picker-item:hover {
  background: var(--glass);
  color: var(--text-primary);
}
.collection-picker-item.checked {
  color: var(--neon-cyan);
}
.collection-picker-check {
  font-size: 1rem;
  display: flex;
  align-items: center;
}
.collection-picker-check ion-icon { font-size: 1rem; }
.collection-picker-item .collection-emoji {
  font-size: 0.85rem;
}
.collection-picker-new {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
  border-top: 1px solid var(--border);
  transition: color 0.1s;
}
.collection-picker-new:hover {
  color: var(--neon-cyan);
  background: var(--glass);
}

/* Collection Emoji Picker */
.coll-emoji-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.1s;
}
.coll-emoji-btn:hover {
  background: var(--glass);
  transform: scale(1.1);
}
.coll-emoji-btn.selected {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.1);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.3);
}

/* Library Image Detail Overlay */
.lib-detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lib-detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.lib-detail-panel {
  position: relative;
  width: 90vw;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.lib-detail-panel::-webkit-scrollbar { width: 6px; }
.lib-detail-panel::-webkit-scrollbar-track { background: transparent; }
.lib-detail-panel::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.lib-detail-close {
  position: sticky;
  top: 8px;
  float: right;
  margin: 8px 8px 0 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: var(--text-primary);
  font-size: 1.25rem;
  z-index: 2;
  transition: background 0.15s;
}
.lib-detail-close:hover { background: rgba(255, 255, 255, 0.15); }

.lib-detail-content {
  padding: var(--sp-lg);
}
.lib-detail-media {
  margin-bottom: var(--sp-lg);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #000;
  display: flex;
  justify-content: center;
}
.lib-detail-media img,
.lib-detail-media video {
  display: block;
}

.lib-detail-meta {
  margin-bottom: var(--sp-lg);
}
.lib-detail-prompt {
  margin-bottom: var(--sp-md);
}
.lib-detail-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
  display: block;
}
.lib-detail-prompt p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.lib-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lib-detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.lib-detail-tag ion-icon { font-size: 0.8rem; }

.lib-detail-collections {
  margin-top: var(--sp-sm);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lib-detail-coll-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  color: var(--coll-color, var(--neon-cyan));
  background: color-mix(in srgb, var(--coll-color, var(--neon-cyan)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--coll-color, var(--neon-cyan)) 25%, transparent);
}

.lib-detail-actions {
  border-top: 1px solid var(--border);
  padding-top: var(--sp-md);
}
.lib-detail-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-sm);
}
.lib-detail-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lib-tool-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  transition: all 0.15s;
  cursor: pointer;
}
.lib-tool-btn:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.06);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.1);
}
.lib-tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.lib-tool-btn ion-icon { font-size: 1rem; }
.lib-tool-btn--danger:hover:not(:disabled) {
  color: var(--neon-red);
  border-color: var(--neon-red);
  background: rgba(239, 68, 68, 0.06);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.1);
}

/* Tool processing status */
.lib-detail-tool-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  background: rgba(0, 240, 255, 0.06);
  border: 1px solid rgba(0, 240, 255, 0.15);
  font-size: 0.8rem;
  color: var(--neon-cyan);
}
.lib-detail-tool-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 240, 255, 0.3);
  border-top-color: var(--neon-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Detail overlay mobile */
@media (max-width: 768px) {
  .lib-detail-panel {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .lib-detail-content {
    padding: var(--sp-md);
  }
  .lib-detail-tools {
    gap: 6px;
  }
  .lib-tool-btn {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
}

/* Thread Cards */
.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--sp-md);
}

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

.thread-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.thread-card-cover {
  height: 180px;
  background: var(--bg-tertiary);
  position: relative;
}

.thread-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thread-card-body {
  padding: var(--sp-md);
}

.thread-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--sp-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-card-meta {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

/* History List */
.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.history-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-md);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.history-item:hover {
  background: var(--glass-highlight);
}

.history-prompt {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-context {
  font-size: 0.625rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--glass);
  color: var(--text-tertiary);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.history-time {
  font-size: 0.6875rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* =============================================
   SETTINGS PAGE
   ============================================= */

.settings-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}

.settings-group {
  margin-bottom: var(--sp-xl);
}

.settings-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-md);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-md) 0;
  border-bottom: 1px solid var(--border);
}

.setting-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.setting-name {
  font-size: 0.9375rem;
  font-weight: 500;
}

.setting-desc {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Toggle Switch */
.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--bg-elevated);
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle.active {
  background: var(--neon-cyan);
}

.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s var(--ease-spring);
}

.toggle.active::after {
  transform: translateX(20px);
}

/* Provider Cards (BYOK) */
.provider-card {
  margin-bottom: var(--sp-md);
  padding: var(--sp-md) var(--sp-lg);
  border: 1px solid var(--border);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.provider-card--configured {
  border-color: color-mix(in srgb, var(--provider-color, var(--neon-cyan)) 40%, transparent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--provider-color, var(--neon-cyan)) 10%, transparent);
}

.provider-card-header {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  margin-bottom: var(--sp-md);
}

.provider-card-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--bg-elevated);
}

.provider-card-info {
  flex: 1;
  min-width: 0;
}

.provider-card-name {
  font-size: 0.9375rem;
  font-weight: 600;
}

.provider-card-desc {
  line-height: 1.3;
  margin-top: 2px;
}

.provider-card-status {
  flex-shrink: 0;
}

.provider-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-disabled);
}

.provider-dot--active {
  background: var(--status-success);
  box-shadow: 0 0 6px var(--neon-green-glow);
}

.provider-dot--error {
  background: var(--status-error);
  box-shadow: 0 0 6px var(--neon-red-glow);
}

.provider-card-body {
  padding-top: var(--sp-sm);
  border-top: 1px solid var(--border);
}

.provider-key-row {
  display: flex;
  gap: var(--sp-sm);
  align-items: center;
}

.provider-key-row .neon-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.provider-card-actions {
  display: flex;
  gap: var(--sp-sm);
  margin-top: var(--sp-sm);
  flex-wrap: wrap;
}

.provider-card-msg {
  min-height: 1.2em;
}

.provider-card-msg ion-icon {
  vertical-align: -2px;
  margin-right: 2px;
}

.neon-input--sm {
  padding: 6px 10px;
  font-size: 0.8125rem;
}

.spinner--sm {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

.provider-clear-btn {
  margin-left: auto;
}

/* Provider Select in Create Page Sidebar */
.provider-select {
  width: 100%;
  font-size: 0.8125rem;
  margin-bottom: var(--sp-xs);
}

/* API Key Input (legacy) */
.api-key-wrap {
  display: flex;
  gap: var(--sp-sm);
}

.api-key-wrap .neon-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* =============================================
   FULLSCREEN IMAGE PREVIEW
   ============================================= */

.fullscreen-preview {
  position: fixed;
  inset: 0;
  z-index: 2500;
  background: rgba(0,0,0,0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s var(--ease-out);
  cursor: zoom-out;
}

.fullscreen-preview.open {
  opacity: 1;
  visibility: visible;
}

.fullscreen-preview img {
  max-width: 95vw;
  max-height: 95vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.fullscreen-close {
  position: absolute;
  top: var(--sp-lg);
  right: var(--sp-lg);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background 0.15s;
}

.fullscreen-close:hover {
  background: rgba(255,255,255,0.2);
}

/* =============================================
   EMPTY STATES
   ============================================= */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2xl);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state ion-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-md);
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: var(--sp-xs);
}

.empty-state p {
  font-size: 0.875rem;
  max-width: 320px;
}

/* =============================================
   RESPONSIVE BREAKPOINTS
   ============================================= */

/* Tablet */
@media (max-width: 1024px) {
  .create-page {
    grid-template-columns: 1fr 300px;
  }

  .gallery-grid {
    columns: 3;
  }

  .pg-masonry {
    columns: 3;
  }

  .top-bar-center .nav-link span {
    display: none;
  }

  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: static;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --top-bar-height: 54px;
  }

  #top-bar {
    display: flex;
    height: var(--top-bar-height);
    padding: 0 var(--sp-md);
  }

  .top-bar-center {
    display: none;
  }

  .top-bar-right {
    gap: 6px;
  }

  .top-bar-right .icon-btn:not(#btn-settings) {
    display: none;
  }

  .top-bar-right .icon-btn,
  .top-bar-right .user-avatar {
    width: 32px;
    height: 32px;
  }

  .logo-img {
    height: 32px;
  }

  .credits-badge {
    padding: 4px 10px;
    font-size: 12px;
  }

  .credits-badge ion-icon {
    font-size: 13px;
  }

  .nav-signin-btn {
    padding: 7px 12px;
    font-size: 0.75rem;
  }

  #bottom-bar {
    display: flex;
  }

  #content {
    margin-top: var(--top-bar-height);
    padding-bottom: calc(var(--bottom-bar-height) + env(safe-area-inset-bottom, 0));
  }

  .create-page {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--top-bar-height) - var(--bottom-bar-height));
    height: calc(100dvh - var(--top-bar-height) - var(--bottom-bar-height));
  }

  .pg-masonry {
    columns: 2;
    padding: 0 var(--sp-md);
  }

  .pg-masonry > .pg-card:nth-child(6n + 2) { margin-top: 8px; }
  .pg-masonry > .pg-card:nth-child(6n + 3) { margin-top: 12px; }
  .pg-masonry > .pg-card:nth-child(6n + 4) { margin-top: 4px; }
  .pg-masonry > .pg-card:nth-child(6n + 5) { margin-top: 10px; }

  .pg-hero h1 {
    font-size: 1.5rem;
  }

  .pg-section {
    padding: 0 var(--sp-md);
  }

  .pg-tabs {
    padding: 0 var(--sp-md);
  }

  .pg-image-overlay {
    padding: 0;
  }
  .pg-image-detail {
    flex-direction: column;
    width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
  }
  .pg-image-detail-img img,
  .pg-image-detail-img video {
    max-height: 55dvh;
  }
  .pg-image-detail-sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 45dvh;
  }

  .pipeline-flow-body {
    padding: var(--sp-lg) var(--sp-md);
  }

  .pipeline-slots {
    grid-template-columns: 1fr;
  }

  .pipeline-controls {
    flex-direction: column;
  }

  .pipeline-model-row {
    width: 100%;
  }

  .pipeline-generate-btn {
    width: 100%;
  }

  .create-sidebar {
    position: fixed;
    bottom: var(--bottom-bar-height);
    left: 0;
    right: 0;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    transform: translateY(100%);
    transition: transform 0.3s var(--ease-out);
    z-index: 500;
  }

  .create-sidebar.open {
    transform: translateY(0);
  }

  .canvas-main {
    margin: var(--sp-sm);
    min-height: 200px;
  }

  .canvas-thumbs {
    padding: 0 var(--sp-sm) var(--sp-xs);
  }

  .thumb {
    width: 44px;
    height: 44px;
  }

  /* Canvas overlay: always visible + icon-only buttons on mobile */
  .canvas-main-overlay {
    opacity: 1;
    pointer-events: auto;
    background: linear-gradient(transparent 30%, rgba(0,0,0,0.7));
    padding: var(--sp-sm);
  }
  .canvas-main-actions .btn {
    font-size: 0;
    padding: 8px;
    min-width: 36px;
    min-height: 36px;
    gap: 0;
  }
  .canvas-main-actions .btn ion-icon {
    font-size: 1.15rem;
  }

  .viewer-image-helper-card {
    padding: 16px 14px 14px;
  }

  .viewer-image-helper-title {
    font-size: 0.95rem;
  }

  .viewer-image-helper-copy {
    font-size: 0.875rem;
  }

  .viewer-image-helper-actions {
    flex-direction: column;
  }

  .viewer-image-helper-actions .btn {
    width: 100%;
  }

  .gallery-grid {
    columns: 2;
  }

  .gallery-detail {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .gallery-detail-sidebar {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 40vh;
  }

  .page-section {
    padding: 0 var(--sp-md);
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-sm);
  }

  .style-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--sp-xs);
  }

  .thread-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-sm);
  }

  .settings-page {
    padding: var(--sp-lg) var(--sp-md);
  }

  .docs-page {
    padding: var(--sp-lg) var(--sp-md) var(--sp-2xl);
  }

  .docs-header {
    flex-direction: column;
  }

  .docs-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .docs-topic-grid {
    grid-template-columns: 1fr;
  }

  /* Stack page headers vertically on mobile */
  .page-header.flex {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--sp-sm);
  }

  .page-title {
    font-size: 1.25rem;
  }

  .page-subtitle {
    font-size: 0.8125rem;
  }

  /* Library tabs scroll horizontally if needed */
  .library-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .library-tab {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 6px 12px;
  }

  /* Inpaint editor mobile adjustments */
  .inpaint-toolbar {
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-md);
  }

  .inpaint-size {
    flex: 0 0 100%;
    order: 10;
  }

  /* Toasts above bottom bar on mobile */
  #toasts {
    bottom: calc(var(--bottom-bar-height) + var(--sp-md) + env(safe-area-inset-bottom, 0));
    right: var(--sp-md);
    left: var(--sp-md);
  }

  .toast {
    font-size: 0.8125rem;
  }

  /* Modal: tighter on mobile */
  .modal {
    margin: var(--sp-md);
    max-height: 85vh;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .pg-mode-tabs,
  .pg-tabs,
  .pg-community-content-tabs {
    flex-wrap: wrap;
  }

  .pg-community-spotlight {
    grid-auto-columns: 84vw;
  }

  .gallery-grid {
    columns: 1;
  }

  .pg-masonry {
    columns: 1;
  }

  .pg-masonry > .pg-card:nth-child(n) {
    margin-top: 0;
  }

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

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

  .thread-grid {
    grid-template-columns: 1fr;
  }

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

/* =============================================
   IMAGE UPLOAD AREA
   ============================================= */

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
}

.upload-area:hover {
  border-color: rgba(0, 240, 255, 0.3);
  background: rgba(0, 240, 255, 0.03);
}

.upload-area.dragover {
  border-color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.05);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

.upload-area ion-icon {
  font-size: 2rem;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-sm);
}

/* =============================================
   SHARE TO GALLERY BUTTON
   ============================================= */

.share-gallery-btn {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(236, 72, 153, 0.15));
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: var(--neon-purple);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: all 0.2s;
}

.share-gallery-btn:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.25), rgba(236, 72, 153, 0.25));
  transform: translateY(-1px);
}

/* =============================================
   GENERATION QUEUE
   ============================================= */

.queue-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.queue-item {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  font-size: 0.8125rem;
}

.queue-item-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.queue-status-queued { background: var(--text-tertiary); }
.queue-status-starting { background: var(--neon-yellow); animation: status-blink 1s infinite; }
.queue-status-processing { background: var(--neon-cyan); animation: status-blink 1s infinite; }
.queue-status-retrying { background: var(--neon-yellow); animation: status-blink 0.5s infinite; }
.queue-status-succeeded { background: var(--neon-green); }
.queue-status-failed { background: var(--neon-red); }

@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.queue-item-prompt {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.queue-item-cancel {
  color: var(--text-tertiary);
  font-size: 1rem;
  transition: color 0.15s;
}

.queue-item-cancel:hover {
  color: var(--neon-red);
}


/* =============================================
   PAGE 404
   ============================================= */

.page-404 {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
}

.page-404 h1 {
  font-size: 4rem;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-404 p {
  color: var(--text-secondary);
  margin-top: var(--sp-sm);
}

/* App footer (legal links) */
.app-footer {
  display: flex;
  justify-content: center;
  gap: var(--sp-md);
  padding: var(--sp-lg) var(--sp-md);
  font-size: 0.75rem;
}
.app-footer a {
  color: var(--text-disabled);
  transition: color 0.15s;
}
.app-footer a:hover { color: var(--text-secondary); }

/* =============================================
   MOBILE SIDEBAR HANDLE
   ============================================= */
.sidebar-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

/* =============================================
   NEGATIVE PROMPT TOGGLE
   ============================================= */
.neg-prompt-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  cursor: pointer;
  margin-bottom: var(--sp-xs);
}

.neg-prompt-toggle:hover {
  color: var(--text-secondary);
}

.neg-prompt-section {
  display: none;
}

.neg-prompt-section.open {
  display: block;
}

/* =============================================
   SIDEBAR BACKDROP & CLOSE
   ============================================= */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 499;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .sidebar-backdrop {
    display: block;
  }
}

.sidebar-top-row {
  display: none;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: var(--sp-xs) var(--sp-sm) 0;
}

.sidebar-close-btn {
  display: none;
  position: absolute;
  right: var(--sp-sm);
  top: var(--sp-xs);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 1.25rem;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.sidebar-close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 768px) {
  .sidebar-top-row {
    display: flex;
  }
  .sidebar-close-btn {
    display: flex;
  }
}

/* =============================================
   ADVANCED SETTINGS ACCORDION
   ============================================= */
.advanced-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
  width: 100%;
  padding: var(--sp-sm) var(--sp-md);
  margin-bottom: var(--sp-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.advanced-toggle:hover {
  color: var(--text-primary);
  border-color: var(--neon-cyan-dim);
}

.advanced-toggle ion-icon:first-child {
  font-size: 1rem;
  color: var(--neon-cyan-dim);
}

.advanced-toggle-arrow {
  margin-left: auto;
  font-size: 0.875rem;
  transition: transform 0.25s var(--ease-out);
}

.advanced-toggle.open .advanced-toggle-arrow {
  transform: rotate(180deg);
}

.advanced-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease-out);
}

.advanced-panel.open {
  max-height: 600px;
}

/* =============================================
   PROMPT ATTACHMENT THUMBNAILS
   ============================================= */
.prompt-attachments {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.prompt-attachments:empty {
  display: none;
}

.prompt-attachment {
  position: relative;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: visible;
  border: 2px solid var(--neon-cyan-dim);
}

.prompt-attachment img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius-sm) - 2px);
}

.prompt-attachment-remove {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--neon-red);
  color: #fff;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
  border: 2px solid var(--bg-tertiary);
}

.prompt-attachment-remove:hover {
  transform: scale(1.15);
}

/* Form Match attachment */
.prompt-attachment--form {
  border-color: #FF69B4;
  position: relative;
}

.form-attachment-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #FF69B4;
  border: 1px solid #FF1493;
  z-index: 2;
  pointer-events: none;
}

.form-attachment-label {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #FF69B4;
  background: var(--bg-tertiary);
  padding: 0 3px;
  white-space: nowrap;
  z-index: 2;
}

#form-match-btn.active {
  color: #FF69B4;
}

/* =============================================
   IMAGE CHAINING - USE IN PROMPT BUTTON
   ============================================= */
.btn-chain {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple)) !important;
  color: #050507 !important;
  border: none !important;
  font-weight: 600;
}

.btn-chain:hover {
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.4) !important;
}

/* Chain icon on thumbnails */
.thumb {
  position: relative;
}

.thumb-chain-btn {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--neon-cyan);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
  border: 1px solid rgba(0, 240, 255, 0.3);
}

.thumb:hover .thumb-chain-btn {
  opacity: 1;
}

.thumb-chain-btn:hover {
  background: var(--neon-cyan);
  color: #050507;
}

/* Video badge on thumbnails */
.thumb--video { position: relative; }
.thumb-video-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  color: #fff;
  font-size: 0.6rem;
  pointer-events: none;
}
.thumb--video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* =============================================
   PROMPT LIBRARY POPOVER
   ============================================= */
.prompt-library-popover {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: var(--sp-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5);
  max-height: 360px;
  display: flex;
  flex-direction: column;
  z-index: 600;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.2s var(--ease-out);
}

.prompt-library-popover.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.popover-tabs {
  display: flex;
  gap: var(--sp-xs);
}

.popover-tab {
  padding: var(--sp-xs) var(--sp-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
  background: transparent;
}

.popover-tab:hover {
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.04);
}

.popover-tab.active {
  color: var(--neon-cyan);
  background: rgba(0, 240, 255, 0.08);
}

.popover-close {
  color: var(--text-tertiary);
}

.popover-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-sm);
}

.popover-empty {
  text-align: center;
  color: var(--text-disabled);
  font-size: 0.8125rem;
  padding: var(--sp-lg) var(--sp-md);
}

.popover-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  width: 100%;
  padding: var(--sp-sm) var(--sp-md);
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  color: var(--text-primary);
}

.popover-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.popover-item-text {
  flex: 1;
  font-size: 0.8125rem;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.popover-item-meta {
  font-size: 0.6875rem;
  color: var(--text-disabled);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.modifier-item {
  padding-left: calc(var(--sp-md) + 3px);
}

.modifier-delete {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  background: transparent;
  color: var(--text-disabled);
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}

.popover-item:hover .modifier-delete {
  opacity: 1;
}

.modifier-delete:hover {
  color: var(--neon-red);
  background: rgba(239, 68, 68, 0.1);
}

/* =============================================
   MOBILE OVERRIDES - COMPOSER CARD
   ============================================= */
@media (max-width: 768px) {
  /* --- Prompt wrap: flex-wrap reflow into stacked rows --- */
  .prompt-input-wrap {
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px;
    border-radius: var(--radius-md);
  }

  /* --- Row 1: Attachment strip (full-width, horizontal) --- */
  .prompt-attachments {
    order: 1;
    flex: 0 0 100%;
    flex-wrap: wrap;
  }

  .prompt-attachments:empty {
    display: none;
  }

  .prompt-attachments .prompt-attachment {
    width: 40px;
    height: 40px;
  }

  .prompt-attachment--form {
    order: 1;
    border-color: #FF69B4;
    background: rgba(255, 105, 180, 0.06);
  }

  .prompt-attachment-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border: 2px solid var(--bg-tertiary);
    touch-action: manipulation;
  }

  /* --- Row 2: Full-width textarea wrap (the actual flex item) --- */
  .prompt-textarea-wrap {
    order: 2;
    flex: 0 0 100%;
    min-height: 72px;
  }

  .prompt-textarea {
    min-height: 72px;
    max-height: 200px;
    font-size: 1rem;
    line-height: 1.5;
    padding: var(--sp-sm);
  }

  .prompt-highlight-layer {
    padding: var(--sp-sm);
    font-size: 1rem;
    line-height: 1.5;
  }

  /* --- Row 3: All toolbar buttons in one row --- */
  .prompt-input-wrap > .icon-btn {
    order: 3;
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 1.15rem;
    align-self: center;
  }

  .prompt-actions {
    order: 3;
    margin-left: auto;
    gap: 4px;
  }

  .prompt-actions .icon-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    font-size: 1.15rem;
  }

  .prompt-action-btn {
    height: 40px;
    min-height: 40px;
    padding: 0 12px;
    font-size: 0.8125rem;
    gap: 6px;
  }

  .prompt-action-btn ion-icon {
    font-size: 1rem;
  }

  .prompt-send-btn {
    min-width: 102px;
    border-radius: var(--radius-md);
  }

  .prompt-remix-btn {
    min-width: 78px;
  }

  /* --- Popover: adapt for taller prompt bar --- */
  .prompt-library-popover {
    max-height: 50vh;
  }

  /* --- Modifier autocomplete: position above prompt bar --- */
  .modifier-autocomplete {
    max-height: 200px;
  }
}

/* ============================================
   Model Browser
   ============================================ */

.model-browser-results {
  max-height: 400px;
  overflow-y: auto;
}

.model-browser-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}

.model-browser-item:hover {
  background: var(--bg-tertiary);
  border-color: rgba(255,255,255,0.05);
}

.model-browser-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
}

.model-browser-thumb--icon,
.model-detail-cover--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.model-browser-thumb--icon ion-icon {
  font-size: 1.25rem;
}

.model-browser-info {
  flex: 1;
  min-width: 0;
}

.model-browser-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  flex-shrink: 0;
}

.model-browser-actions .btn {
  white-space: nowrap;
}

.model-browser-name {
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.model-browser-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}

.model-detail-header {
  display: flex;
  gap: var(--sp-md);
  align-items: flex-start;
}

.model-detail-cover {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
}

.model-detail-cover--icon ion-icon {
  font-size: 2rem;
}

.schema-params {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.schema-param {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--sp-xs);
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  font-size: 0.75rem;
}

.schema-param-name {
  font-family: var(--font-mono);
  color: var(--neon-cyan);
  font-weight: 600;
}

.schema-param-type {
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.schema-param-desc {
  width: 100%;
  color: var(--text-secondary);
  font-size: 0.7rem;
  line-height: 1.3;
}

.schema-param-default {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.model-detail-view .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.7rem;
}

@media (max-width: 768px) {
  .model-browser-item {
    align-items: flex-start;
  }

  .model-browser-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

#custom-model-params .input-group {
  margin-bottom: var(--sp-xs);
}

#custom-model-params .input-label {
  font-size: 0.7rem;
  margin-bottom: 2px;
}

/* ============================================
   Auth Page Styles
   ============================================ */
.auth-page {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - var(--top-bar-height));
  padding: var(--sp-lg);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-2xl) var(--sp-xl);
}
.auth-logo {
  text-align: center; margin-bottom: var(--sp-xl);
}
.auth-logo-img {
  height: 48px; width: auto;
}
.auth-logo p {
  color: var(--text-secondary); font-size: 14px;
}
.auth-card h2 {
  font-size: 20px; font-weight: 600; margin-bottom: var(--sp-sm);
}
.auth-subtitle {
  color: var(--text-secondary); font-size: 14px; margin-bottom: var(--sp-lg);
}
.form-group { margin-bottom: var(--sp-md); }
.form-input {
  width: 100%; padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px; font-family: var(--font-sans);
  outline: none; transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--neon-cyan); }
.form-input::placeholder { color: var(--text-tertiary); }
.form-group label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: var(--sp-xs);
}
.btn-full { width: 100%; justify-content: center; }
.btn-danger-ghost {
  background: transparent; color: var(--neon-red);
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger-ghost:hover {
  background: rgba(239,68,68,0.1);
  border-color: var(--neon-red);
}
.btn-danger-outline {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--neon-red);
  color: var(--neon-red);
  font-weight: 600;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.2);
}
.btn-danger-outline ion-icon {
  font-size: 1rem;
}
.auth-sent-icon {
  text-align: center; font-size: 48px;
  color: var(--neon-cyan); margin-bottom: var(--sp-md);
}
.auth-success-icon { color: var(--neon-green); }
.auth-error-icon { color: var(--neon-red); }
.auth-sent h3, .auth-card h3 {
  font-size: 18px; text-align: center; margin-bottom: var(--sp-sm);
}
.auth-sent p, .auth-hint {
  color: var(--text-secondary); font-size: 14px;
  text-align: center; margin-bottom: var(--sp-md);
}
.auth-debug {
  margin-top: var(--sp-md); padding: var(--sp-md);
  background: rgba(249,115,22,0.1);
  border: 1px solid rgba(249,115,22,0.3);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.auth-footer {
  margin-top: var(--sp-xl); text-align: center;
  font-size: 12px; color: var(--text-tertiary);
}
.auth-footer a { color: var(--neon-cyan); }
#auth-verify-loading { text-align: center; padding: var(--sp-xl) 0; }
#auth-verify-loading .spinner { width: 32px; height: 32px; margin: 0 auto; border-width: 3px; }

/* ============================================
   Account Page Styles
   ============================================ */
.account-page {
  max-width: 600px; margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}
.account-unauthenticated {
  display: flex; align-items: center; justify-content: center;
  min-height: 60vh;
}
.auth-prompt-card {
  text-align: center;
  padding: var(--sp-2xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.auth-prompt-card ion-icon {
  font-size: 48px; color: var(--neon-cyan); margin-bottom: var(--sp-md);
}
.auth-prompt-card h2 { margin-bottom: var(--sp-sm); }
.auth-prompt-card p {
  color: var(--text-secondary); margin-bottom: var(--sp-lg);
}
.account-header {
  display: flex; align-items: center; gap: var(--sp-lg);
  padding-bottom: var(--sp-xl);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-xl);
}
.account-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #000;
  flex-shrink: 0;
}
.account-info h2 { font-size: 20px; margin-bottom: 2px; }
.account-email { color: var(--text-secondary); font-size: 14px; margin-bottom: var(--sp-xs); }
.badge {
  display: inline-block; padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
}
.badge-free { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-plus { background: rgba(0,240,255,0.15); color: var(--neon-cyan); }
.badge-pro { background: rgba(168,85,247,0.15); color: var(--neon-purple); }
.account-section {
  margin-bottom: var(--sp-xl);
}
.account-section h3 {
  font-size: 16px; font-weight: 600;
  margin-bottom: var(--sp-md);
  color: var(--text-secondary);
}
.credits-display {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.credits-number {
  font-size: 32px; font-weight: 700;
  color: var(--neon-cyan);
  font-family: var(--font-mono);
}
.credits-label {
  display: block; font-size: 13px; color: var(--text-secondary);
}
.credit-history { display: flex; flex-direction: column; gap: 2px; }
.credit-tx {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
}
.credit-tx-desc { font-size: 13px; }
.credit-tx-date { font-size: 11px; color: var(--text-tertiary); }
.credit-tx-amount {
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
}
.credit-tx-positive .credit-tx-amount { color: var(--neon-green); }
.credit-tx-negative .credit-tx-amount { color: var(--neon-red); }
.account-actions {
  display: flex; gap: var(--sp-md); flex-wrap: wrap;
}
/* Active subscription on account page */
.account-subscription {
    padding: var(--sp-lg); background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.account-sub-info { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-sm); }
.account-sub-period { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.account-sub-credits { font-size: 13px; color: var(--text-tertiary); margin-bottom: var(--sp-md); }
.account-sub-actions { display: flex; gap: var(--sp-sm); }

.account-plan-actions { display: flex; gap: var(--sp-sm); }

/* Credits badge in nav */
.credits-badge {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 12px; border-radius: var(--radius-full);
  background: rgba(0,240,255,0.1);
  color: var(--neon-cyan);
  font-size: 13px; font-weight: 600;
  font-family: var(--font-mono);
  text-decoration: none !important;
  transition: background 0.2s;
}
.credits-badge:hover { background: rgba(0,240,255,0.2); }
.credits-badge ion-icon { font-size: 14px; }
.credits-badge--byok {
  background: rgba(249,115,22,0.12);
  color: #f97316;
}
.credits-badge--byok:hover { background: rgba(249,115,22,0.22); }
.credits-badge--low {
  background: rgba(239,68,68,0.12); color: #ef4444;
  animation: credits-pulse 2s ease-in-out infinite;
}
.credits-badge--low:hover { background: rgba(239,68,68,0.22); }
@keyframes credits-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.nav-signin-btn { white-space: nowrap; }

/* ============================================
   Docs Page Styles
   ============================================ */
.docs-page {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg) var(--sp-2xl);
}
.docs-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-lg);
}
.docs-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.18);
  color: var(--neon-cyan);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-md);
  padding: var(--sp-md);
  margin-bottom: var(--sp-lg);
}
.docs-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.docs-search-wrap ion-icon {
  color: var(--text-secondary);
  font-size: 1.1rem;
}
.docs-search-wrap .neon-input {
  flex: 1;
  min-width: 0;
}
.docs-toolbar-stat {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: var(--sp-lg);
  align-items: start;
}
.docs-sidebar {
  position: sticky;
  top: calc(var(--top-bar-height) + var(--sp-md));
  padding: var(--sp-lg);
}
.docs-sidebar-title {
  margin-bottom: var(--sp-sm);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.docs-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}
.docs-nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
.docs-nav-link--muted {
  opacity: 0.35;
}
.docs-sidebar-note {
  margin-top: var(--sp-md);
  line-height: 1.6;
}
.docs-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xl);
}
.docs-section {
  scroll-margin-top: calc(var(--top-bar-height) + var(--sp-lg));
}
.docs-section-head {
  margin-bottom: var(--sp-md);
}
.docs-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius-full);
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.22);
  color: #d8b4fe;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.docs-topic-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-md);
}
.docs-topic-card {
  padding: var(--sp-lg);
  border-color: rgba(255, 255, 255, 0.08);
}
.docs-topic-card h3 {
  margin-bottom: var(--sp-sm);
  font-size: 1rem;
}
.docs-topic-card p {
  margin-bottom: var(--sp-md);
  color: var(--text-secondary);
  line-height: 1.65;
}
.docs-bullet-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.docs-bullet-list li {
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ============================================
   Pricing Page Styles
   ============================================ */
.pricing-page {
  max-width: 1100px; margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}
.pricing-header {
  text-align: center; margin-bottom: var(--sp-2xl);
}
.pricing-header h1 { font-size: 28px; margin-bottom: var(--sp-sm); }
.pricing-header p { color: var(--text-secondary); font-size: 15px; }
.pricing-current-balance {
  display: inline-flex; align-items: center; gap: var(--sp-xs);
  margin-top: var(--sp-md);
  padding: var(--sp-sm) var(--sp-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px; color: var(--text-secondary);
}
.pricing-current-balance ion-icon { color: var(--neon-cyan); }
.pricing-current-balance strong { color: var(--text-primary); }
.pricing-section-header { margin-bottom: var(--sp-lg); }
.pricing-section-header h2 { font-size: 22px; margin-bottom: var(--sp-xs); }
.pricing-section-header .pricing-section-desc { margin-bottom: 0; }
.pricing-alert {
  display: flex; align-items: center; gap: var(--sp-sm);
  padding: var(--sp-md); margin-bottom: var(--sp-xl);
  border-radius: var(--radius-md);
}
.pricing-alert-success {
  background: var(--status-success-bg);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--neon-green);
}
.pricing-alert-canceled {
  background: var(--status-error-bg);
  border: 1px solid rgba(239,68,68,0.3);
  color: var(--neon-red);
}
.pricing-alert-pending {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}
.pricing-section { margin-bottom: var(--sp-2xl); }
.pricing-section h2 {
  font-size: 22px; margin-bottom: var(--sp-xs);
}
.pricing-section-desc {
  color: var(--text-secondary); font-size: 14px;
  margin-bottom: var(--sp-lg);
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-md);
}
.pricing-card-byok {
  border-color: rgba(249, 115, 22, 0.25);
}
.pricing-card-byok:hover {
  border-color: rgba(249, 115, 22, 0.4);
}
.pricing-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-xl) var(--sp-lg);
  text-align: center;
  transition: border-color 0.3s;
}
.pricing-card:hover { border-color: rgba(255,255,255,0.1); }
.pricing-card-popular {
  border-color: var(--neon-cyan);
  background: linear-gradient(180deg, rgba(0,240,255,0.04), transparent);
}
.pricing-popular-badge {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  padding: 3px 14px; border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
  color: #000; font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.pricing-card-header h3 { font-size: 18px; margin-bottom: var(--sp-xs); }
.pricing-card-price {
  font-size: 32px; font-weight: 800;
  margin-bottom: var(--sp-sm);
}
.pricing-price-struck {
  font-size: 18px; font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: line-through;
  margin-right: 8px;
}
.pricing-price-current {
  /* inherits from .pricing-card-price */
}
.pricing-promo-badge {
  display: inline-block;
  padding: 4px 12px;
  margin-bottom: var(--sp-sm);
  font-size: 12px; font-weight: 700;
  font-family: var(--font-mono);
  background: linear-gradient(135deg, var(--neon-yellow), var(--accent-warm));
  color: #000;
  border-radius: 20px;
}
.pricing-fine-print {
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: var(--sp-xl);
}
.pricing-card-credits {
  font-size: 15px; color: var(--neon-cyan);
  font-weight: 600; margin-bottom: var(--sp-xs);
}
.pricing-card-per {
  font-size: 12px; color: var(--text-tertiary);
  margin-bottom: var(--sp-md);
}
.pricing-card-features {
  list-style: none; margin-bottom: var(--sp-lg);
  text-align: left;
}
.pricing-card-features li {
  padding: var(--sp-xs) 0;
  font-size: 13px; color: var(--text-secondary);
  border-bottom: 1px solid var(--divider);
}
.pricing-card-features li:last-child { border: none; }
.pricing-toggle {
  display: flex; gap: 4px; justify-content: center;
  margin-bottom: var(--sp-xl);
  padding: 4px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
  width: fit-content; margin-left: auto; margin-right: auto;
}
.pricing-toggle-btn {
  padding: 8px 20px; border: none; border-radius: var(--radius-full);
  background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: var(--font-sans); transition: all 0.2s;
}
.pricing-toggle-btn.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
}
.pricing-save-badge {
  font-size: 10px; padding: 2px 6px;
  background: rgba(16,185,129,0.2);
  color: var(--neon-green);
  border-radius: var(--radius-full);
  margin-left: 4px;
}
.pricing-period { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.pricing-costs {
  padding: var(--sp-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pricing-costs h2 { font-size: 18px; margin-bottom: var(--sp-md); }
.pricing-cost-item {
  display: flex; justify-content: space-between;
  padding: var(--sp-sm) var(--sp-md);
  font-size: 13px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}
.pricing-cost-item span:last-child {
  color: var(--neon-cyan); font-family: var(--font-mono); font-weight: 500;
}
.pricing-cost-divider {
  grid-column: 1 / -1;
  background: transparent;
  margin-top: var(--sp-sm);
  font-weight: 600;
}
.pricing-costs-section {
  margin-bottom: var(--sp-lg);
}
.pricing-costs-section:last-child { margin-bottom: 0; }
.pricing-costs-section h3 {
  display: flex; align-items: center; gap: var(--sp-xs);
  font-size: 15px; font-weight: 600; margin-bottom: var(--sp-sm);
}
.pricing-costs-section h3 ion-icon { font-size: 18px; color: var(--neon-cyan); }
.pricing-cost-note { font-size: 12px; font-weight: 400; color: var(--text-tertiary); }
.pricing-cost-name { display: flex; flex-direction: column; gap: 1px; }
.pricing-cost-model { font-weight: 500; color: var(--text-primary); }
.pricing-cost-desc { font-size: 11px; color: var(--text-tertiary); }
.pricing-cost-amount {
  color: var(--neon-cyan); font-family: var(--font-mono); font-weight: 500;
  white-space: nowrap;
}
.pricing-costs-grid {
  display: flex; flex-direction: column;
}
.pricing-free-cta { text-align: center; }
.pricing-free-box {
  display: inline-flex; flex-direction: column; align-items: center; gap: var(--sp-md);
  padding: var(--sp-2xl) var(--sp-xl);
  background: linear-gradient(180deg, rgba(0,240,255,0.03), transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 480px; margin: 0 auto;
}
.pricing-free-box h3 { font-size: 20px; }
.pricing-free-box p { font-size: 14px; color: var(--text-secondary); margin: 0; }
.pricing-card-features li strong {
  color: var(--text-primary); font-weight: 600;
}
.pricing-card-features li ion-icon {
  color: var(--neon-green); font-size: 14px; margin-right: 6px;
  vertical-align: -2px;
}
.pricing-card-examples {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  margin-bottom: var(--sp-md);
}
.pricing-example {
  display: inline-block;
  padding: 3px 10px;
  font-size: 11px; font-weight: 500;
  background: var(--bg-tertiary);
  border: 1px solid var(--divider);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  white-space: nowrap;
}
.pricing-grid-packs {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.pricing-byok-callout { margin-top: var(--sp-xl); }
.pricing-byok-box {
  display: flex; align-items: center; gap: var(--sp-lg);
  padding: var(--sp-xl);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.pricing-byok-icon {
  width: 56px; height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  background: rgba(249, 115, 22, 0.1);
}
.pricing-byok-icon ion-icon, .pricing-byok-box > ion-icon {
  font-size: 28px; color: #f97316; flex-shrink: 0;
}
.pricing-byok-text { flex: 1; }
.pricing-byok-box h3 { font-size: 16px; margin-bottom: var(--sp-xs); }
.pricing-byok-box p {
  font-size: 13px; color: var(--text-secondary); margin: 0; line-height: 1.5;
}
.pricing-byok-box .btn { flex-shrink: 0; white-space: nowrap; }
@media (max-width: 768px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .pricing-grid-subs { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid-packs { grid-template-columns: repeat(2, 1fr); }
  .pricing-card { padding: var(--sp-lg) var(--sp-md); }
  .pricing-header h1 { font-size: 24px; }
}
@media (max-width: 640px) {
  .pricing-grid-subs { grid-template-columns: 1fr; }
  .pricing-grid-packs { grid-template-columns: 1fr; max-width: 340px; margin: 0 auto; }
  .pricing-byok-box { flex-direction: column; text-align: center; }
  .pricing-byok-box .btn { width: 100%; }
  .pricing-card-examples { justify-content: center; }
}

/* ============================================
   Legal Page Styles
   ============================================ */
.legal-page {
  max-width: 800px; margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}
.legal-nav {
  display: flex; gap: var(--sp-md);
  margin-bottom: var(--sp-xl);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border);
}
.legal-nav a {
  color: var(--text-secondary); font-size: 14px;
  text-decoration: none; padding: var(--sp-xs) var(--sp-sm);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.legal-nav a.active, .legal-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Prose (shared for legal + blog) */
.prose { line-height: 1.8; }
.prose h1 { font-size: 28px; margin-bottom: var(--sp-lg); }
.prose h2 {
  font-size: 20px; margin-top: var(--sp-xl);
  margin-bottom: var(--sp-md);
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border);
}
.prose h2:first-of-type { border-top: none; padding-top: 0; }
.prose h3 { font-size: 16px; margin-top: var(--sp-lg); margin-bottom: var(--sp-sm); }
.prose p { color: var(--text-secondary); margin-bottom: var(--sp-md); font-size: 14px; }
.prose ul, .prose ol {
  padding-left: var(--sp-xl); margin-bottom: var(--sp-md);
}
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li {
  color: var(--text-secondary); font-size: 14px;
  margin-bottom: var(--sp-xs);
}
.prose strong { color: var(--text-primary); }
.prose em { font-style: italic; }
.prose a { color: var(--neon-cyan); }
.prose code {
  background: var(--bg-tertiary); padding: 2px 6px;
  border-radius: 4px; font-family: var(--font-mono);
  font-size: 13px;
}
.prose pre {
  background: var(--bg-tertiary); padding: var(--sp-md);
  border-radius: var(--radius-sm);
  overflow-x: auto; margin-bottom: var(--sp-md);
}
.prose pre code {
  background: none; padding: 0;
  font-size: 13px;
}
.prose blockquote {
  border-left: 3px solid var(--neon-cyan);
  padding-left: var(--sp-md);
  margin: var(--sp-md) 0;
  color: var(--text-secondary);
}
.prose hr {
  border: none; border-top: 1px solid var(--border);
  margin: var(--sp-xl) 0;
}
.prose img {
  max-width: 100%; border-radius: var(--radius-md);
  margin: var(--sp-md) 0;
}
.prose table {
  width: 100%; border-collapse: collapse;
  margin-bottom: var(--sp-md);
}
.prose th, .prose td {
  padding: var(--sp-sm) var(--sp-md);
  border: 1px solid var(--border);
  font-size: 13px; text-align: left;
}
.prose th {
  background: var(--bg-tertiary);
  font-weight: 600;
}

/* ============================================
   Blog Page Styles
   ============================================ */
.blog-page {
  max-width: 900px; margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}
.blog-header {
  text-align: center; margin-bottom: var(--sp-2xl);
}
.blog-header h1 { font-size: 28px; margin-bottom: var(--sp-sm); }
.blog-header p { color: var(--text-secondary); }
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--sp-lg);
}
.blog-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none !important;
  transition: border-color 0.3s, transform 0.3s;
}
.blog-card:hover {
  border-color: rgba(255,255,255,0.1);
  transform: translateY(-2px);
}
.blog-card-image {
  height: 160px; overflow: hidden;
}
.blog-card-image img {
  width: 100%; height: 100%; object-fit: cover;
}
.blog-card-content { padding: var(--sp-lg); }
.blog-card-meta {
  display: flex; align-items: center; gap: var(--sp-sm);
  margin-bottom: var(--sp-sm);
}
.blog-card-date { font-size: 12px; color: var(--text-tertiary); }
.blog-card-tag, .blog-tag {
  padding: 2px 8px; border-radius: var(--radius-full);
  background: rgba(0,240,255,0.1);
  color: var(--neon-cyan);
  font-size: 11px; font-weight: 500;
}
.blog-card h2 {
  font-size: 16px; margin-bottom: var(--sp-sm);
  color: var(--text-primary);
}
.blog-card p {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.5;
}

/* Blog Post */
.blog-post-page {
  max-width: 760px; margin: 0 auto;
  padding: var(--sp-xl) var(--sp-lg);
}
.blog-back {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--text-secondary) !important;
  font-size: 14px; margin-bottom: var(--sp-lg);
  text-decoration: none !important;
}
.blog-back:hover { color: var(--text-primary) !important; }
.blog-post-header h1 {
  font-size: 28px; line-height: 1.3;
  margin-bottom: var(--sp-md);
}
.blog-post-meta {
  display: flex; align-items: center; gap: var(--sp-md);
  flex-wrap: wrap;
  font-size: 13px; color: var(--text-tertiary);
  margin-bottom: var(--sp-xl);
  padding-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--border);
}
.blog-post-body { margin-top: var(--sp-lg); }

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-page { padding: var(--sp-lg); max-width: 1400px; margin: 0 auto; }
.admin-panel { padding: var(--sp-md) 0; }
.admin-header { margin-bottom: var(--sp-lg); }
.admin-header h1 { font-size: 24px; display: flex; align-items: center; gap: var(--sp-sm); }
.admin-header h1 ion-icon { color: var(--neon-cyan); }

/* Tabs */
.admin-tabs {
    display: flex; gap: 2px; margin-bottom: var(--sp-lg);
    background: var(--surface-alt); border-radius: var(--radius-lg);
    padding: 3px; overflow-x: auto;
}
.admin-tab {
    padding: 8px 16px; border: none; background: none;
    color: var(--text-secondary); font-size: 13px; font-weight: 500;
    cursor: pointer; border-radius: var(--radius-md);
    white-space: nowrap; transition: all 0.15s;
}
.admin-tab:hover { color: var(--text-primary); }
.admin-tab.active { background: var(--surface-hover); color: var(--neon-cyan); }

/* Stat Cards */
.admin-stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-md); margin-bottom: var(--sp-lg);
}
.admin-stat-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--sp-lg);
}
.admin-stat-label { font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); margin: 4px 0; }
.admin-stat-sub { font-size: 12px; color: var(--text-tertiary); }

/* Charts */
.admin-charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); margin-bottom: var(--sp-lg); }
.admin-chart-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--sp-lg);
}
.admin-chart-card h3 { font-size: 14px; margin-bottom: var(--sp-md); }

.admin-bar-chart { height: 160px; }
.bar-chart-inner { display: flex; align-items: flex-end; gap: 3px; height: 100%; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar { width: 100%; background: linear-gradient(to top, var(--neon-cyan), var(--neon-purple)); border-radius: 3px 3px 0 0; min-height: 2px; transition: height 0.3s; }
.bar:hover { opacity: 0.8; }
.bar-label { font-size: 10px; color: var(--text-tertiary); margin-top: 4px; }

.admin-plan-bars { display: flex; flex-direction: column; gap: var(--sp-sm); }
.admin-plan-bar { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: var(--surface-alt); border-radius: var(--radius-md); }
.admin-plan-label { font-size: 13px; text-transform: capitalize; }
.admin-plan-count { font-weight: 600; color: var(--neon-cyan); }

/* Toolbar */
.admin-toolbar {
    display: flex; gap: var(--sp-sm); margin-bottom: var(--sp-md);
    flex-wrap: wrap; align-items: center;
}
.admin-search {
    flex: 1; min-width: 200px; padding: 8px 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text-primary);
    font-size: 13px;
}
.admin-search:focus { border-color: var(--neon-cyan); outline: none; }
.admin-select, .admin-select-sm {
    padding: 8px 12px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text-primary); font-size: 13px;
}
.admin-select-sm { padding: 4px 8px; font-size: 12px; }

/* Tables */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th {
    text-align: left; padding: 8px 10px; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-tertiary); border-bottom: 1px solid var(--border);
    background: var(--surface-alt); white-space: nowrap;
}
.admin-table td {
    padding: 8px 10px; border-bottom: 1px solid var(--border-subtle, rgba(255,255,255,0.04));
    max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-table tr:hover td { background: var(--surface-hover); }
.admin-table-sm { font-size: 12px; }
.admin-table-sm th, .admin-table-sm td { padding: 6px 8px; }
.admin-table a { color: var(--neon-cyan); text-decoration: none; }
.admin-table a:hover { text-decoration: underline; }
.mono { font-family: var(--font-mono, 'JetBrains Mono', monospace); font-size: 11px; }

/* Badges */
.badge-admin { background: var(--neon-cyan); color: #000; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.badge-ban { background: var(--neon-magenta); color: #fff; padding: 1px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; }
.badge-type { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-byok { background: rgba(249, 115, 22, 0.15); color: #f97316; }
.badge-credits { background: rgba(0, 240, 255, 0.1); color: var(--neon-cyan); }
.badge-role { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; text-transform: capitalize; }
.badge-free { background: rgba(255,255,255,0.05); color: var(--text-tertiary); }
.badge-plus { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.badge-pro { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge-studio { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.badge-status { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.badge-active, .badge-succeeded { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-canceled { background: rgba(161, 161, 170, 0.15); color: #a1a1aa; }
.badge-started { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.badge-tx-purchase { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-tx-subscription { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.badge-tx-signup { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge-tx-generation { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.badge-tx-refund { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.badge-tx-admin { background: rgba(0, 240, 255, 0.1); color: var(--neon-cyan); }
.badge-tx-promo { background: rgba(236, 72, 153, 0.15); color: #ec4899; }

.tx-positive { color: #10b981; font-weight: 600; }
.tx-negative { color: #ef4444; font-weight: 600; }

/* Pagination */
.admin-pagination { margin-top: var(--sp-md); }
.admin-pager { display: flex; align-items: center; gap: var(--sp-md); justify-content: center; }
.admin-page-info { font-size: 12px; color: var(--text-tertiary); }
.btn-xs { padding: 4px 10px; font-size: 11px; }

/* User Detail Modal */
.admin-modal {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 40px 20px; overflow-y: auto;
}
.admin-modal-content {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); max-width: 900px; width: 100%;
    max-height: calc(100vh - 80px); overflow-y: auto;
}
.admin-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.admin-modal-header h2 { font-size: 18px; }
.admin-modal-close { background: none; border: none; color: var(--text-secondary); font-size: 24px; cursor: pointer; padding: 0 4px; }
.admin-modal-close:hover { color: var(--text-primary); }
.admin-modal-body { padding: 20px; }
.admin-modal-body h3 { font-size: 14px; margin: 20px 0 8px; color: var(--text-secondary); }

.user-detail-grid { display: grid; gap: var(--sp-md); }
.user-detail-row { display: flex; align-items: center; gap: var(--sp-md); padding: 4px 0; }
.user-detail-row label { min-width: 110px; font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }
.user-detail-row span { font-size: 13px; }
.user-detail-actions { display: flex; gap: var(--sp-sm); margin-top: var(--sp-md); padding-top: var(--sp-md); border-top: 1px solid var(--border); }

/* Models section */
.admin-models-section { margin-bottom: var(--sp-xl); }
.admin-models-section h3 { font-size: 15px; margin-bottom: var(--sp-md); }

/* Thumbnails */
.admin-thumb {
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background-size: cover; background-position: center;
    background-color: var(--surface-alt);
}

/* Dual bar chart */
.bar-chart-dual { gap: 6px; }
.bar-col-dual { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; gap: 2px; align-items: flex-end; width: 100%; height: calc(100% - 18px); }
.bar-pair .bar { flex: 1; }
.bar-visits { background: linear-gradient(to top, var(--neon-cyan), var(--neon-purple)); }
.bar-visitors { background: linear-gradient(to top, var(--neon-green), var(--neon-cyan)); }
.bar-earned { background: linear-gradient(to top, var(--neon-green), var(--neon-green-dim)); }
.bar-spent { background: linear-gradient(to top, var(--neon-magenta), var(--neon-magenta-dim)); }
.chart-legend { display: flex; align-items: center; gap: var(--sp-sm); font-size: 11px; color: var(--text-tertiary); margin-top: var(--sp-sm); justify-content: center; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend-visits { background: var(--neon-cyan); }
.legend-visitors { background: var(--neon-green); }
.legend-earned { background: var(--neon-green); }
.legend-spent { background: var(--neon-magenta); }

/* Gallery Moderation Grid */
.admin-gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-md); }
.admin-gallery-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: border-color 0.15s;
}
.admin-gallery-card:hover { border-color: var(--border-active); }
.admin-gallery-removed { opacity: 0.5; }
.admin-gallery-img {
    width: 100%; height: 180px;
    background-size: cover; background-position: center;
    background-color: var(--surface-alt);
}
.admin-gallery-img--video { position: relative; overflow: hidden; }
.admin-gallery-img--video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    display: block;
}
.admin-gallery-info { padding: var(--sp-sm) var(--sp-md) var(--sp-md); }
.admin-gallery-badges { display: flex; gap: 4px; margin-bottom: 4px; flex-wrap: wrap; }
.admin-gallery-prompt { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.4; }
.admin-gallery-meta { display: flex; gap: var(--sp-sm); font-size: 11px; color: var(--text-tertiary); margin-bottom: 8px; flex-wrap: wrap; }
.admin-gallery-actions { display: flex; gap: 4px; flex-wrap: wrap; }

/* Admin Mailbox */
.admin-mailbox {
    display: grid;
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
    gap: var(--sp-md);
    min-height: 640px;
}
.admin-mail-list,
.admin-mail-detail {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.admin-mail-list {
    display: flex;
    flex-direction: column;
    max-height: 75vh;
    overflow-y: auto;
}
.admin-mail-item {
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: transparent;
    transition: background 0.15s, border-color 0.15s;
}
.admin-mail-item:hover,
.admin-mail-item.active {
    background: var(--surface-hover);
}
.admin-mail-item--unread {
    border-left: 3px solid var(--neon-cyan);
    padding-left: 13px;
}
.admin-mail-item-top,
.admin-mail-meta,
.admin-mail-detail-meta,
.admin-mail-detail-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    flex-wrap: wrap;
}
.admin-mail-item-top {
    justify-content: space-between;
    margin-bottom: 4px;
}
.admin-mail-from,
.admin-mail-subject {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.admin-mail-from { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.admin-mail-date,
.admin-mail-meta,
.admin-mail-detail-meta { font-size: 11px; color: var(--text-tertiary); }
.admin-mail-subject { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; }
.admin-mail-detail {
    display: flex;
    flex-direction: column;
}
.admin-mail-detail-header {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-md);
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}
.admin-mail-detail-header h3 {
    font-size: 18px;
    margin-bottom: 8px;
}
.admin-mail-body {
    margin: 0;
    padding: 20px;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Content Tab Sections */
.admin-content-section {
    margin-bottom: var(--sp-2xl); padding-bottom: var(--sp-xl);
    border-bottom: 1px solid var(--border);
}
.admin-content-section:last-child { border-bottom: none; }
.admin-section-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: var(--sp-sm);
}
.admin-section-header h3 {
    font-size: 16px; display: flex; align-items: center; gap: var(--sp-sm);
}
.admin-section-header h3 ion-icon { color: var(--neon-cyan); }
.admin-section-desc { font-size: 13px; color: var(--text-tertiary); margin-bottom: var(--sp-md); }

/* Showcase Grid */
.admin-showcase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-md); }
.admin-showcase-card {
    display: flex; gap: var(--sp-md);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--sp-md);
    transition: border-color 0.15s;
}
.admin-showcase-card:hover { border-color: var(--border-active); }
.admin-showcase-inactive { opacity: 0.5; }
.admin-showcase-img {
    width: 80px; height: 80px; flex-shrink: 0;
    background-size: cover; background-position: center;
    background-color: var(--surface-alt);
    border-radius: var(--radius-md);
}
.admin-showcase-info { flex: 1; min-width: 0; }
.admin-showcase-meta { display: flex; gap: var(--sp-sm); align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.admin-showcase-prompt { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px; line-height: 1.3; }
.admin-showcase-actions { display: flex; gap: 4px; }

/* Pipeline Cards */
.admin-pipelines-list { display: flex; flex-direction: column; gap: var(--sp-md); }
.admin-pipeline-card {
    display: flex; gap: var(--sp-md); align-items: flex-start;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: var(--sp-lg);
    transition: border-color 0.15s;
}
.admin-pipeline-card:hover { border-color: var(--border-active); }
.admin-pipeline-inactive { opacity: 0.5; }
.admin-pipeline-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(0,240,255,0.1), rgba(168,85,247,0.1));
    border-radius: var(--radius-md); font-size: 22px; color: var(--neon-cyan);
}
.admin-pipeline-info { flex: 1; min-width: 0; }
.admin-pipeline-name { font-size: 14px; font-weight: 600; margin-bottom: 2px; display: flex; align-items: center; gap: var(--sp-sm); }
.admin-pipeline-desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.admin-pipeline-meta { display: flex; gap: var(--sp-md); font-size: 11px; color: var(--text-tertiary); margin-bottom: 4px; }
.admin-pipeline-hidden { font-size: 11px; color: var(--text-tertiary); font-family: var(--font-mono); line-height: 1.4; }
.admin-pipeline-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }

/* Admin Form Elements */
.admin-form-group { margin-bottom: var(--sp-md); }
.admin-form-group label { display: block; font-size: 12px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px; }
.admin-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-md); }
.admin-input {
    width: 100%; padding: 8px 12px;
    background: var(--bg-tertiary); border: 1px solid var(--border);
    border-radius: var(--radius-md); color: var(--text-primary);
    font-size: 13px; font-family: var(--font-sans);
}
.admin-input:focus { border-color: var(--neon-cyan); outline: none; }
.admin-textarea { resize: vertical; min-height: 60px; }
.admin-code { font-family: var(--font-mono); font-size: 12px; }
.admin-form-actions { display: flex; gap: var(--sp-sm); justify-content: flex-end; padding-top: var(--sp-md); border-top: 1px solid var(--border); margin-top: var(--sp-md); }

/* Toggle switch */
.admin-toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.admin-toggle input { opacity: 0; width: 0; height: 0; }
.admin-toggle-slider {
    position: absolute; inset: 0;
    background: var(--bg-tertiary); border-radius: 11px;
    transition: 0.2s; border: 1px solid var(--border);
}
.admin-toggle-slider::before {
    content: ''; position: absolute;
    width: 16px; height: 16px; left: 2px; bottom: 2px;
    background: var(--text-secondary); border-radius: 50%;
    transition: 0.2s;
}
.admin-toggle input:checked + .admin-toggle-slider { background: var(--neon-cyan); border-color: var(--neon-cyan); }
.admin-toggle input:checked + .admin-toggle-slider::before { transform: translateX(18px); background: #000; }

/* Responsive */
@media (max-width: 768px) {
    .admin-page { padding: var(--sp-md); }
    .admin-charts-row { grid-template-columns: 1fr; }
    .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .admin-stat-value { font-size: 22px; }
    .admin-tabs { gap: 0; }
    .admin-tab { padding: 6px 10px; font-size: 12px; }
    .admin-gallery-grid { grid-template-columns: 1fr; }
    .admin-showcase-grid { grid-template-columns: 1fr; }
    .admin-form-row { grid-template-columns: 1fr; }
    .admin-pipeline-card { flex-direction: column; }
    .admin-pipeline-actions { flex-direction: row; }
    .admin-mailbox { grid-template-columns: 1fr; }
    .admin-mail-list { max-height: 320px; }
    .admin-mail-detail-header { flex-direction: column; }
}
