/* Self-hosted Inter font — no external requests */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../assets/fonts/inter-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../assets/fonts/inter-500.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../assets/fonts/inter-600.woff2') format('woff2');
}

/* Premium Color Palette */
:root {
  --brand-primary: #6366f1;
  --brand-primary-soft: rgba(99, 102, 241, 0.1);
  --primary-color: #6366f1;
  --primary-soft: rgba(99, 102, 241, 0.1);
  --secondary-color: #f43f5e;
  /* Vibrant coral/rose */
  --accent-color: #DFD116;

  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --border-color: #e2e8f0;

  --charcoal: #334155;
  /* Richer Slate 700 */
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #475569;

  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.08);

  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 32px;
  --header-bg: rgba(255, 255, 255, 0.9);
  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-main: #020617; /* Very dark slate */
  --bg-surface: #0f172a; /* Dark slate 900 */
  --header-bg: rgba(15, 23, 42, 0.9); /* Translucent dark slate */
  --border-color: #1e293b; /* Dark slate 800 */
  --text-main: #f8fafc; /* Light slate 50 */
  --text-muted: #94a3b8; /* Slate 400 */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.6);
  --slate-200: #1e293b;
  --slate-400: #64748b;
  --charcoal: #e2e8f0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

/* Header */
.header {
  position: sticky;
  top: 20px;
  z-index: 100;
  padding: 0 24px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  box-shadow: var(--shadow-md);
}

.brand-group {
  display: flex;
  flex-direction: column;
  min-width: 100px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text-main);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand svg {
  color: var(--brand-primary);
  width: 24px;
  height: 24px;
}

.tagline-text {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  opacity: 0.8;
  margin-left: 6px;
}

.tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  opacity: 0.6;
  margin-top: -2px;
}

.tagline em {
  font-style: normal;
  color: var(--text-main);
  font-weight: 600;
}

.header-search {
  flex: 1;
  max-width: 600px;
  display: flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  padding: 0 20px;
  height: 44px;
  transition: all var(--transition-smooth);
}

.header-search:focus-within {
  border-color: var(--brand-primary);
  background: var(--bg-surface);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.1);
}

.search-icon {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  margin-right: 12px;
}

#searchInput {
  border: none;
  background: transparent;
  width: 100%;
  height: 100%;
  font-size: 0.9375rem;
  color: var(--text-main);
  outline: none;
  font-weight: 500;
}

#searchInput::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.v-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
}

.profile-btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-smooth);
}

.profile-btn-icon:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
  background: var(--brand-primary-soft);
}

.control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.control-label {
  font-size: 0.6875rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  opacity: 0.8;
}

/* Palette & Presets */
.palette-picker-wrapper {
  position: relative !important;
  display: flex !important;
  align-items: center;
  gap: 16px;
}

.palette-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-main);
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
}

.presets-toggle-btn {
  display: flex !important;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface) !important;
  border: 1px solid var(--border-color) !important;
  padding: 8px 16px !important;
  border-radius: 99px !important;
  font-size: 0.8125rem !important;
  font-weight: 600 !important;
  color: var(--text-main) !important;
  cursor: pointer !important;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.presets-toggle-btn:hover {
  border-color: var(--brand-primary) !important;
  background: var(--bg-main) !important;
}

.presets-toggle-btn svg {
  color: var(--brand-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.theme-toggle-btn {
  display: flex !important;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.theme-toggle-btn:hover {
  border-color: var(--brand-primary);
  background: var(--bg-main);
}

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

/* Popover Content */
.presets-popover {
  position: fixed;
  width: 240px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  padding: 16px;
  display: none;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}

.presets-popover.active {
  display: flex !important;
}

.popover-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 8px;
}

.presets-grid {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.presets-grid::-webkit-scrollbar {
  width: 4px;
}

.presets-grid::-webkit-scrollbar-track {
  background: transparent;
}

.presets-grid::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 99px;
}

.preset-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
}

.preset-item:hover {
  background: var(--bg-main);
  border-color: var(--brand-primary);
}

.preset-item::before {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: conic-gradient(var(--p) 0 120deg, var(--s) 120deg 240deg, var(--a) 240deg 360deg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.preset-name {
  font-size: 0.875rem;
  font-weight: 500;
}

.animate-toggle {
  display: flex;
  align-items: center;
  background: var(--bg-main);
  padding: 4px 8px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
}

.color-control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}


/* Custom Color Picker Popover */
.custom-color-picker {
  position: absolute;
  z-index: 10000;
  width: 280px;
  background: #1e293b;
  /* Dark slate matching reference */
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  gap: 16px;
  user-select: none;
  border: 1px solid #334155;
}

.cp-saturation-square {
  width: 100%;
  height: 160px;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  background-color: #ff0000;
  /* Base hue */
}

.cp-white-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to right, #fff, transparent);
}

.cp-black-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, #000, transparent);
}

.cp-cursor {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.cp-hue-slider-container {
  padding: 0 4px;
}

.cp-hue-slider {
  width: 100%;
  height: 12px;
  position: relative;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}

.cp-hue-cursor {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  background: #fff;
  border: 2px solid #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.cp-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cp-preview-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: #ff0000;
}

.cp-hex-input-container {
  flex: 1;
  background: #0f172a;
  border-radius: 8px;
  border: 1px solid #334155;
  padding: 8px 12px;
  display: flex;
  align-items: center;
}

.cp-hex-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  outline: none;
}

.cp-eyedropper-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #334155;
  border: 1px solid #475569;
  border-radius: 8px;
  color: #f1f5f9;
  cursor: pointer;
  transition: all 0.2s;
}

.cp-eyedropper-btn:hover {
  background: #475569;
  transform: scale(1.05);
}

.cp-eyedropper-btn:active {
  transform: scale(0.95);
}

.color-picker-wrapper {
  position: relative;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.color-display {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.color-picker-wrapper:hover .color-display {
  transform: scale(1.15);
}

/* Hide native color inputs since we use custom picker */
input[type="color"] {
  display: none;
}

/* Animation Toggle */
.animate-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-main);
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid var(--border-color);
}

.toggle-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

input:checked+.slider {
  background-color: var(--brand-primary);
}

input:checked+.slider:before {
  transform: translateX(16px);
}

/* Meaningful Animation Keyframes */

/* 1. Data Flow: Moving elements along a path */
@keyframes data-flow {
  0% {
    transform: translate(-20px, 0);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  80% {
    opacity: 1;
  }

  100% {
    transform: translate(40px, 0);
    opacity: 0;
  }
}

/* 2. Typing: Quick vertical shifts for character hands */
@keyframes typing {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

/* 3. Pulse Glow: For status indicators or important nodes */
@keyframes pulse-glow {

  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0px var(--primary-color));
  }

  50% {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px var(--primary-color));
  }
}

/* 4. Draw Line: For charts or network paths */
@keyframes draw-line {
  from {
    stroke-dashoffset: 1000;
  }

  to {
    stroke-dashoffset: 0;
  }
}

/* 4b. Scanning: Smooth vertical sweep */
@keyframes scanning {

  0%,
  100% {
    transform: translateY(-80px);
  }

  50% {
    transform: translateY(80px);
  }
}

/* 5. Floating (Organic): Substantial but soft movement */
@keyframes organic-float {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  33% {
    transform: translateY(-12px) rotate(2deg);
  }

  66% {
    transform: translateY(-5px) rotate(-1deg);
  }
}

/* 6. Bouncy Scale: For interaction entry or highlights */
@keyframes bounce-scale {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }

  70% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(1);
  }
}

/* Animation Keyframes */
@keyframes float {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

@keyframes float-slow {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.7;
    transform: scale(1.05);
  }
}

@keyframes rotate-slow {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@keyframes slide-right {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(10px);
  }
}

/* Toggle-driven Classes */
.anim-data {
  animation: data-flow 2s infinite linear;
}

.anim-typing {
  animation: typing 0.15s infinite ease-in-out;
}

.anim-glow {
  animation: pulse-glow 2s infinite var(--transition-smooth);
}

.anim-draw {
  animation: draw-line 3s infinite alternate var(--transition-smooth);
}

.anim-float {
  animation: float 4s ease-in-out infinite;
}

.anim-bounce {
  animation: bounce 2s ease-in-out infinite;
}

.anim-float-slow {
  animation: float-slow 4s ease-in-out infinite;
}

.anim-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.anim-rotate {
  animation: rotate-slow 12s linear infinite;
  transform-origin: center;
}

.anim-slide {
  animation: slide-right 2.5s ease-in-out infinite;
}

.anim-scan {
  animation: scanning 2.5s ease-in-out infinite;
}

/* Global SVG Optimizations */
.ud {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  fill: none;
}



/* Main Grid */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 40px 40px;
}

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

.card,
.illustration-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-smooth);
  display: flex;
  flex-direction: column;
  position: relative;
}

.card::after,
.illustration-card::after {
  content: 'View & Download';
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--text-main);
  color: var(--bg-main);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  opacity: 0;
  transform: translateY(10px);
  transition: all var(--transition-smooth);
  pointer-events: none;
}

.card:hover::after,
.illustration-card:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.card:hover,
.illustration-card:hover {
  border-color: var(--brand-primary);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.04);
  transform: translateY(-4px);
}

.card-visual,
.card-preview {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
}

.card-visual svg,
.card-preview svg {
  width: 100%;
  height: 100%;
  max-width: 180px;
}

.card-info {
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-main);
}

.card-icon {
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

/* Standard Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%);
  width: 90%;
  max-width: 600px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  z-index: 101;
  opacity: 0;
  pointer-events: none;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.modal-window.active {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%);
}

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

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

.modal-close {
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--bg-main);
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-artwork {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  padding: 24px;
}

.modal-artwork svg {
  max-width: 200px;
  max-height: 100%;
}

.modal-license {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.modal-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.75rem;
  color: var(--text-main);
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 99px;
  text-transform: capitalize;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  align-items: center;
}

.modal-footer .divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
}

.btn {
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  transition: all var(--transition-smooth);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--text-main);
  color: #fff;
  flex: 1;
  /* Make the copy button prominent */
}

.btn-primary.btn-success {
  background: #10b981;
  border-color: #10b981;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
}

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

.grid-footer {
  text-align: center;
  padding: 40px 0;
  display: none;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
  padding: 0 0 20px 0;
}

.pagination .btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  min-width: 100px;
}

.pagination .page-info {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pagination .btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--slate-200);
  border-color: var(--slate-200);
  color: var(--text-muted);
}

/* Visibility Sync and Inline SVG Override */
body:not(.animate-active) svg * {
  animation: none !important;
  animation-play-state: paused !important;
}

.tab-hidden * {
  animation-play-state: paused !important;
}

/* Responsive Fixes & Premium UI Polish */
@media (max-width: 1024px) {
  .main-container {
    padding: 40px 24px 80px;
  }

  .grid {
    gap: 32px;
  }
}

@media (max-width: 768px) {
  .header {
    top: 10px;
    padding: 0 16px;
  }

  .header-container {
    flex-direction: column;
    padding: 16px 20px;
    border-radius: 24px;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
  }

  .brand-group {
    width: 100%;
    display: flex;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 0px;
  }

  .brand {
    flex-wrap: nowrap;
    justify-content: center;
    gap: 8px;
  }

  .logo-text {
    font-size: 1.25rem !important;
  }

  .logo-icon {
    width: 28px !important;
    height: 28px !important;
  }

  .v-divider {
    display: none;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 16px;
    margin-top: 8px;
  }

  .header-actions .tagline {
    display: none;
  }

  .header-search {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    background: #f8fafc;
    /* Lighter slate */
    border: 1.5px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.25s ease;
  }

  .header-search:focus-within {
    background: #fff;
    border-color: var(--brand-primary);
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.12);
    transform: translateY(-1px);
  }

  .header-search #searchInput {
    font-size: 0.9375rem;
    padding: 10px 0;
    line-height: normal;
    font-weight: 500;
    flex: 1;
    color: var(--text-main);
  }

  .search-icon {
    width: 18px;
    height: 18px;
    margin-right: 12px;
    color: var(--slate-400);
    flex-shrink: 0;
  }

  .color-display {
    width: 32px;
    height: 32px;
  }

  .presets-toggle-btn {
    padding: 10px 20px !important;
    font-size: 0.9375rem !important;
  }

  /* Grid: Switch to 2 columns on tablet/large mobile */
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
  }

  .card-visual,
  .card-preview {
    height: 140px;
  }

  .card-title {
    font-size: 0.875rem;
  }

  /* Modal: Redesign for Touch */
  .modal-window {
    width: 92%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-height: 95vh;
    border-radius: 20px;
  }

  .modal-artwork {
    height: 180px;
    padding: 16px;
  }

  .modal-body {
    padding: 16px;
    overflow-y: auto;
  }

  .modal-footer {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px 20px;
  }

  .modal-footer .divider {
    display: none;
  }

  #copyCodeBtn {
    flex: 1 1 100%;
    padding: 12px;
    order: -1;
    margin-bottom: 4px;
  }

  .modal-footer .btn-secondary {
    flex: 1 1 calc(33% - 6px);
    font-size: 0.75rem;
    padding: 10px 4px;
    min-width: 0;
  }

  #copyImageBtn {
    flex: 1 1 100%;
    order: 0;
  }
}

@media (max-width: 480px) {
  .header-container {
    padding: 16px;
    gap: 16px;
  }

  .header-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .control-group {
    width: auto;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
  }

  .control-label,
  .control-group > span {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    position: absolute !important;
    pointer-events: none !important;
  }

  .palette-picker-wrapper {
    width: auto;
    justify-content: flex-end;
    align-items: center;
  }

  .palette-picker {
    display: none;
  }

  #animateIconBtn,
  .profile-btn-icon,
  .profile-btn {
    width: 36px !important;
    height: 36px !important;
  }

  /* Presets icon-only (no text) */
  .presets-toggle-btn {
    padding: 6px !important;
    font-size: 0 !important;
    width: 36px;
    height: 36px;
    border-radius: 10px !important;
  }

  /* Tighter Grid */
  .grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .card-visual,
  .card-preview {
    height: 120px;
    padding: 12px;
  }

  .card-info {
    padding: 10px;
  }

  .card-title {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Pagination */
  .pagination {
    flex-wrap: wrap;
    gap: 12px;
  }

  .pagination .btn-secondary {
    flex: 1;
    min-width: 80px;
  }

  .page-info {
    order: -1;
    width: 100%;
    text-align: center;
  }
}

/* Fix for tagline dot alignment mentioned by subagent */
.tagline {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Improve button tap feedback for mobile */
.btn:active {
  transform: scale(0.96) !important;
  opacity: 0.8;
}

/* Premium Cookie Banner */
.cookie-banner {
  position: fixed;
  bottom: 24px;
  left: 24px;
  right: 24px;
  max-width: 500px;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px 24px;
  box-shadow: var(--shadow-md);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  transform: translateY(120%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.cookie-banner.active {
  transform: translateY(0);
}

.cookie-content {
  flex: 1;
}

.cookie-title {
  display: block;
  font-weight: 700;
  font-size: 0.9375rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.cookie-text {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.cookie-text a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.cookie-actions {
  display: flex;
  gap: 8px;
}

#acceptCookiesBtn {
  background: var(--text-main);
  color: #fff;
  border-radius: 12px;
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

#acceptCookiesBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@media (max-width: 640px) {
  .cookie-banner {
    bottom: 16px;
    left: 16px;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
    gap: 16px;
  }

  #acceptCookiesBtn {
    width: 100%;
    padding: 12px;
  }
}

/* No Results State */
.no-results-container {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
}

.animate-active .no-results-container {
  animation: fadeIn 0.8s ease-out;
}

.no-results-illustration {
  width: 240px;
  height: 240px;
  margin-bottom: 24px;
}

.no-results-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.no-results-text {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 400px;
  line-height: 1.6;
}

/* Sketchy Ghost Animations */
.animate-active .sketchy-ghost {
  animation: ghostFloat 4s ease-in-out infinite;
}

.animate-active .ghost-eye {
  animation: ghostBlink 5s infinite;
}

.animate-active .sketchy-path {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: drawSketch 3s forwards;
}

@keyframes ghostFloat {

  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-20px) rotate(3deg);
  }
}

@keyframes ghostBlink {

  0%,
  45%,
  50%,
  100% {
    transform: scaleY(1);
  }

  47% {
    transform: scaleY(0.1);
  }
}

@keyframes drawSketch {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* AI FAB (Floating Action Button) */
.ai-fab {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 64px;
  height: 64px;
  background: var(--brand-primary);
  border-radius: 50%;
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  border: 4px solid var(--bg-surface);
  transition: all 0.3s var(--transition-smooth);
}

.ai-fab:hover {
  transform: scale(1.1) translateY(-5px);
  box-shadow: 0 15px 50px rgba(99, 102, 241, 0.6);
}

.ai-fab svg {
  width: 28px;
  height: 28px;
  fill: white;
}

/* AI Grid Card CTA */
.illustration-card.ai-cta-card {
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border: 2px dashed var(--brand-primary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  cursor: pointer;
  gap: 12px;
  min-height: 280px;
}

.ai-cta-card .ai-sparkle-icon {
  font-size: 40px;
  margin-bottom: 8px;
  display: block;
}

.ai-cta-card .card-info {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
}

.ai-cta-card h3 {
  font-size: 1.25rem !important;
  color: var(--brand-primary);
  margin: 0 !important;
  line-height: 1.2;
}

.ai-cta-card p {
  font-size: 0.9rem !important;
  color: var(--text-muted);
  margin: 0 !important;
  line-height: 1.4;
  max-width: 200px;
}

/* AI Modal */
.ai-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.ai-modal {
  background: var(--bg-surface);
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: all 0.5s ease;
}

.animate-active .ai-modal {
  animation: modal-pop 0.4s var(--transition-smooth);
}

/* AI Aura - Indigo Glow Theme (Theme Aware) */
.ai-modal-overlay.ai-aura {
  background: rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .ai-modal-overlay.ai-aura {
  background: rgba(15, 23, 42, 0.85);
}

.ai-modal-overlay.ai-aura .ai-modal {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid rgba(99, 102, 241, 0.3);
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

.ai-modal-overlay.ai-aura .ai-modal-header {
  background: var(--brand-primary-soft);
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.ai-modal-overlay.ai-aura .ai-modal-header h2 {
  color: var(--brand-primary);
}

.ai-modal-overlay.ai-aura .ai-form-group label {
  color: var(--text-muted);
}

.ai-modal-overlay.ai-aura .ai-form-group input,
.ai-modal-overlay.ai-aura .ai-form-group textarea {
  background: var(--bg-main);
  border-color: var(--border-color);
  color: var(--text-main);
}

.ai-modal-overlay.ai-aura .ai-form-group input:focus,
.ai-modal-overlay.ai-aura .ai-form-group textarea:focus {
  border-color: var(--brand-primary);
}

@keyframes modal-pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ai-modal-header {
  padding: 24px;
  background: var(--brand-primary-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-modal-header h2 {
  font-size: 1.25rem;
  color: var(--brand-primary);
}

.ai-modal-close {
  cursor: pointer;
  opacity: 0.6;
}

.ai-modal-body {
  padding: 24px;
}

.ai-form-group {
  margin-bottom: 20px;
}

.ai-form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
}

.ai-form-group input, 
.ai-form-group textarea, 
.ai-form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.ai-form-group input:focus, 
.ai-form-group textarea:focus {
  border-color: var(--brand-primary);
}

.ai-modal-footer {
  padding: 16px 24px 24px;
  text-align: right;
}

.btn-ai-generate {
  background: var(--brand-primary);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 99px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
  transition: transform 0.2s;
}

.animate-active .btn-ai-generate.loading {
  background: linear-gradient(270deg, var(--brand-primary), var(--brand-secondary), var(--brand-primary));
  background-size: 200% 200%;
  animation: bg-shift 2s ease infinite;
  position: relative;
  overflow: hidden;
  color: #ffffff !important;
  opacity: 1 !important;
}

.btn-ai-generate:disabled:not(.loading) {
  opacity: 0.6;
  cursor: not-allowed;
}

@keyframes bg-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animate-active #aiStatusTicker {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--brand-primary);
  margin-top: 12px;
  animation: ticker-fade 1s infinite alternate;
}

@keyframes ticker-fade {
  from { opacity: 0.6; }
  to { opacity: 1; }
}

.ai-placeholder-card {
  background: #f8fafc;
  border: 2px dashed #e2e8f0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 280px;
  border-radius: 12px;
}

.shimmer-box {
  width: 120px;
  height: 120px;
  background: #f1f5f9;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
}

.animate-active .shimmer-box::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6), transparent);
  animation: shimmer 1.5s infinite;
}

/* Enhanced No Results UX */
.no-results-v2 {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  max-width: 500px;
  margin: 0 auto;
}

.animate-active .no-results-v2 .ghost-container {
  font-size: 80px;
  margin-bottom: 24px;
  filter: drop-shadow(0 10px 20px rgba(0,0,0,0.05));
  animation: ghost-float 3s ease-in-out infinite;
}

@keyframes ghost-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

/* Sketching Loader - Path Drawing Animation */
.sketching-loader {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  position: relative;
}

.sketching-loader svg {
  width: 100%;
  height: 100%;
}

.animate-active .sketch-path {
  fill: none;
  stroke: var(--brand-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 100;
  animation: sketch-draw 2s linear infinite;
}

@keyframes sketch-draw {
  0% { stroke-dashoffset: 100; }
  50% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -100; }
}

.no-results-v2 h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
  line-height: 1.2;
}

.no-results-v2 p {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.5;
}

/* AI Generation Shimmer */
.animate-active .skeleton-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

.animate-active .ai-sparkle {
  animation: pulse-sparkle 2s infinite;
}

@keyframes pulse-sparkle {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

/* Upgrade Modal Custom Styles */
.animate-active .upgrade-modal {
    animation: modalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    0% { opacity: 0; transform: translate(-50%, calc(-50% + 40px)) scale(0.95); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.animate-active .upgrade-sparkle {
    font-size: 3rem;
    margin-bottom: 8px;
    animation: sparkleFloat 3s ease-in-out infinite;
}

@keyframes sparkleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(10deg); }
}

/* ═══════════════════════════════════════════════════════════════
   Compact header — kicks in early enough to prevent overflow
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
  /* 2-row grid: [brand | actions] / [search] */
  .header-container {
    display: grid;
    grid-template-areas: "brand actions" "search search";
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 10px 14px;
    border-radius: 20px;
    gap: 8px 10px;
  }

  .brand-group {
    grid-area: brand;
    width: auto;
    justify-content: flex-start;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
  }

  .brand {
    justify-content: flex-start;
  }

  .header-search {
    grid-area: search;
  }

  .header-actions {
    grid-area: actions;
    width: auto;
    margin-top: 0;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
  }

  /* Compact control group — presets icon only, no color dots */
  .header-actions .control-group {
    display: flex;
    gap: 6px;
    width: auto;
    flex-direction: row;
    align-items: center;
  }

  .palette-picker {
    display: none;
  }

  .presets-toggle-btn {
    padding: 6px !important;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0 !important;
    border-radius: 10px;
  }

  .presets-toggle-btn svg {
    width: 16px;
    height: 16px;
  }

  /* Hide theme toggle — saves space, less critical than presets */
  .theme-toggle-btn {
    display: none;
  }

  .main-container {
    padding: 16px 16px 80px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Touch UX — bottom-sheet modal, tap feedback (phones/tablets)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* No hover effects on touch */
  .card::after,
  .illustration-card::after {
    display: none;
  }

  .card:hover,
  .illustration-card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
  }

  .card:active,
  .illustration-card:active {
    transform: scale(0.98);
    opacity: 0.9;
  }

  /* Bottom-sheet modal */
  .modal-window {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    transform: translateY(102%);
    border-radius: 24px 24px 0 0;
    max-height: 88vh;
    overflow: hidden;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
  }

  .modal-window.active {
    opacity: 1;
    transform: translateY(0);
  }

  .modal-header {
    position: relative;
    padding-top: 28px;
  }

  .modal-header::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
  }

  .modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .modal-artwork {
    height: 200px;
    padding: 20px;
  }

  .modal-footer {
    flex-shrink: 0;
    padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  }

  #copyCodeBtn {
    min-height: 48px;
    font-size: 1rem;
  }

  .modal-footer .btn-secondary {
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .header-actions {
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: auto;
    gap: 6px;
  }

  .header-container {
    padding: 8px 12px;
    gap: 8px;
  }
}

.upgrade-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 86c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zm66 3c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zm-46-3c.552 0 1-.448 1-1s-.448-1-1-1-1 .448-1 1 .448 1 1 1zm26-46c.552 0 1-.448 1-1s-.448-1-1-1-1 .448-1 1 .448 1 1 1zM28 28c.552 0 1-.448 1-1s-.448-1-1-1-1 .448-1 1 .448 1 1 1zm14 44c.552 0 1-.448 1-1s-.448-1-1-1-1 .448-1 1 .448 1 1 1zM80 80c.552 0 1-.448 1-1s-.448-1-1-1-1 .448-1 1 .448 1 1 1zM16 7c.552 0 1-.448 1-1s-.448-1-1-1-1 .448-1 1 .448 1 1 1z' fill='%23ffffff' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.4;
}

/* Premium Profile Dropdown Glassmorphism */
.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 48px;
    width: 240px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.02);
    z-index: 5000;
    padding: 0;
    overflow: hidden;
    transform-origin: top right;
}

.animate-active .profile-dropdown {
    animation: profileFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes profileFadeIn {
    from { opacity: 0; transform: translateY(10px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-pd-header {
    padding: 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(248, 250, 252, 0.5);
}

.profile-pd-name {
    font-weight: 700;
    font-size: 1rem;
    color: #1e293b;
    margin-bottom: 2px;
}

.profile-pd-email {
    font-size: 0.8rem;
    color: #64748b;
    word-break: break-all;
}

.profile-pd-body {
    padding: 12px;
}

.profile-pd-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    transition: background 0.2s;
}

.profile-pd-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #64748b;
    font-size: 0.875rem;
    font-weight: 500;
}

.profile-pd-label svg {
    opacity: 0.7;
}

.badge-plan {
    background: #6366f1;
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.profile-pd-value {
    font-size: 0.875rem;
    color: #1e293b;
    font-weight: 500;
}

.profile-pd-value strong {
    font-weight: 800;
}

.profile-pd-footer {
    padding: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: rgba(248, 250, 252, 0.5);
}

.logout-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: #f43f5e;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    text-align: left;
}

.logout-btn:hover {
    background: #fff1f2;
}

.logout-btn svg {
    opacity: 0.9;
}

/* Magic Sketch Story Loader — Cute & Engaging */
.ai-loader-container {
    position: relative;
    width: 220px;
    height: 160px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-story-loader {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.loader-canvas {
    fill: var(--bg-surface);
    stroke: var(--border-color);
    stroke-width: 1.5;
}

.animate-active .loader-canvas {
    animation: canvas-pop 4s ease-in-out infinite;
}

.magic-stroke {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: sketch-draw 4s ease-in-out infinite;
}

.stroke-1 { stroke: var(--brand-primary); animation-delay: 0.5s; }
.stroke-2 { stroke: var(--brand-secondary); animation-delay: 1.2s; }
.stroke-3 { stroke: var(--accent-color); fill: var(--accent-color); stroke-width: 0; animation-delay: 1.8s; }

.robot-artist {
    transform: translate(20px, 90px);
}

.animate-active .robot-artist {
    animation: robot-sketch 4s ease-in-out infinite;
}

.robot-eyes {
    transform-origin: 12px 8px;
}

.animate-active .robot-eyes {
    animation: robot-blink 4s infinite;
}

.creative-bloom {
    opacity: 0;
    animation: bloom-fade 4s ease-in-out infinite;
}

.orb {
    fill: var(--brand-primary);
    mix-blend-mode: screen;
    opacity: 0.4;
    animation: orb-burst 4s ease-in-out infinite;
}

.orb-2 {
    fill: var(--brand-secondary);
    animation-delay: 0.2s;
}

@keyframes robot-sketch {
    0% { transform: translate(40px, 60px) rotate(-10deg); opacity: 0; }
    15% { opacity: 1; }
    25% { transform: translate(50px, 40px) rotate(5deg); }
    45% { transform: translate(90px, 60px) rotate(-5deg); }
    65% { transform: translate(140px, 50px) rotate(10deg); }
    85% { transform: translate(170px, 70px) rotate(-5deg); opacity: 1; }
    100% { transform: translate(190px, 90px) rotate(0); opacity: 0; }
}

@keyframes robot-blink {
    0%, 46%, 48%, 100% { transform: scaleY(1); }
    47% { transform: scaleY(0); }
}

@keyframes sketch-draw {
    0%, 20% { stroke-dashoffset: 100; opacity: 0; }
    25% { opacity: 1; }
    50%, 80% { stroke-dashoffset: 0; opacity: 1; }
    90%, 100% { opacity: 0; }
}

@keyframes bloom-fade {
    0%, 65% { opacity: 0; transform: scale(0.8); }
    75% { opacity: 1; transform: scale(1.05); }
    90%, 100% { opacity: 0; transform: scale(1.1); }
}

@keyframes orb-burst {
    0%, 65% { transform: scale(0); }
    80% { transform: scale(1.2); }
    100% { transform: scale(1.5); opacity: 0; }
}

@keyframes canvas-pop {
    0%, 100% { transform: scale(1); }
    75% { transform: scale(1.02); }
}

/* AI Mode Switcher Icons */
.ai-mode-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  color: var(--text-muted);
}

.ai-mode-option:hover .ai-mode-icon {
  transform: translateY(-2px) scale(1.15);
  color: var(--brand-primary);
}

.ai-mode-option.active .ai-mode-icon {
  color: var(--brand-primary);
  transform: scale(1.1);
  filter: drop-shadow(0 0 8px var(--brand-primary-soft));
}

/* AI Mode Switcher */
.ai-mode-switcher {
  display: flex;
  background: var(--bg-main);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  gap: 4px;
  margin-top: 8px;
}

.ai-mode-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 0 8px 0;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition-smooth);
  border: 1px solid transparent;
  background: transparent;
  text-align: center;
}

.ai-mode-option:hover {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

.ai-mode-option.active {
  background: var(--bg-surface);
  border-color: var(--brand-primary);
  box-shadow: var(--shadow-sm);
}

.ai-mode-icon {
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.ai-mode-option span {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.ai-mode-option.active span {
  color: var(--brand-primary);
}

[data-theme="dark"] .ai-mode-switcher {
  background: rgba(2, 6, 23, 0.5);
}

/* ═══ Artistic AI Loader ═══════════════════════════════════════════════════ */
.ai-loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  text-align: center;
  min-height: 320px;
}

.ai-loader-canvas {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 32px;
  background: var(--bg-main);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 
    0 10px 25px -5px rgba(0, 0, 0, 0.05),
    0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.ai-loader-canvas::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(var(--border-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-color) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.15;
}

.sketching-aura {
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, var(--brand-primary-soft) 0%, transparent 70%);
  opacity: 0.4;
}

.animate-active .sketching-aura {
  animation: aura-pulse 3s infinite ease-in-out;
}

.sketch-path {
  fill: none;
  stroke: var(--brand-primary);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
}

.animate-active .sketch-path {
  animation: draw-sketch 4s infinite ease-in-out;
}

@keyframes draw-sketch {
  0% { stroke-dashoffset: 1000; opacity: 0; }
  10% { opacity: 1; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  90% { opacity: 1; }
  100% { stroke-dashoffset: -1000; opacity: 0; }
}

@keyframes aura-pulse {
  0%, 100% { transform: scale(0.8); opacity: 0.3; }
  50% { transform: scale(1.2); opacity: 0.6; }
}

.loader-status-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-color);
  transition: all 0.4s ease;
}

.status-dot.active {
  background: var(--brand-primary);
  transform: scale(1.5);
  box-shadow: 0 0 8px var(--brand-primary-soft);
}

#aiStatusTicker {
  margin-top: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  min-height: 1.5em;
  animation: fade-in-up 0.5s ease-out;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
