/* 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: #0ea5e9;

  --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;

  --transition-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  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: rgba(255, 255, 255, 0.95);
  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;
  border-left: 1.5px solid var(--border-color);
  padding-left: 12px;
}

.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: #94a3b8;
}

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

.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: 14px;
  height: 14px;
}

/* 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;
  }
}

/* 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 */
.animate-active .anim-data {
  animation: data-flow 2s infinite linear;
}

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

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

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

.animate-active .anim-float {
  animation: organic-float 6s infinite var(--transition-smooth);
}

.animate-active .anim-bounce {
  animation: bounce-scale 0.8s forwards cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

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

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

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

/* Transform Origins */
.anim-data,
.anim-glow,
.anim-bounce,
.anim-float,
.anim-float-slow,
.anim-rotate,
.anim-pulse {
  transform-origin: center;
  transform-box: fill-box;
}

/* 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: #fff;
  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 */
.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: 28px 24px;
    border-radius: 32px;
    gap: 20px;
    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: 16px;
    margin-bottom: 4px;
  }

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

  .tagline-text {
    margin-left: 0;
    border-left: none;
    padding-left: 0;
    width: 100%;
    text-align: center;
    font-size: 0.8125rem;
    opacity: 0.7;
    margin-top: -4px;
  }

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

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

  .header-search {
    width: 100%;
    min-height: 52px;
    padding: 0 20px;
    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: 1rem;
    padding: 14px 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: column;
    align-items: stretch;
    gap: 20px;
  }

  .control-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .control-label {
    font-size: 0.75rem;
    margin-bottom: -4px;
    align-self: flex-start;
  }

  .palette-picker-wrapper {
    width: 100%;
    justify-content: space-between;
    align-items: center;
  }

  .palette-picker {
    flex: 1;
    justify-content: space-around;
    padding: 8px 16px;
    margin-right: 12px;
  }

  .animate-toggle,
  #animateIconBtn {
    width: 100%;
    height: 48px;
    justify-content: center;
    border-radius: 12px;
  }

  /* 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: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 20px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  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;
  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 */
.sketchy-ghost {
  animation: ghostFloat 4s ease-in-out infinite;
}

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

.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);
  }
}