/* ========================================
   Theme Designer Pro — Preset Gallery
   Zinc dark + blue-500 accent + generous
   radii + spring animations
   ======================================== */

/* --- Design tokens --- */
:root {
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-subtle: rgba(59, 130, 246, 0.08);
  --bg-deep: #09090b;
  --bg-surface: #18181b;
  --bg-elevated: #27272a;
  --border: #3f3f46;
  --border-subtle: #2a2a2e;
  --text-main: #f4f4f5;
  --text-secondary: #d4d4d8;
  --text-muted: #a1a1aa;
  --success: #22c55e;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 100px;
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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



html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: none;
  color: inherit;
}

input, select {
  font-family: inherit;
  border: none;
  outline: 2px solid transparent;
  background: none;
  color: inherit;
}

/* --- Ambient background --- */
.ambient-glow {
  position: fixed;
  top: -30%;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 900px;
  background: radial-gradient(
    ellipse at center,
    rgba(59, 130, 246, 0.06) 0%,
    rgba(59, 130, 246, 0.02) 40%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
  animation: ambientPulse 10s ease-in-out infinite alternate;
}

@keyframes ambientPulse {
  0% { opacity: 0.5; transform: translateX(-50%) scale(1); }
  100% { opacity: 1; transform: translateX(-50%) scale(1.2); }
}

.grain-overlay {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  transition: opacity 0.3s var(--ease-out);
}

.logo:hover {
  opacity: 0.8;
}

.logo-icon {
  color: var(--accent);
}

.header-links {
  display: flex;
  gap: 6px;
}

.header-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s var(--ease-out);
}

.header-link:hover {
  color: var(--text-main);
  background: var(--bg-elevated);
}

.submit-cta {
  background: var(--accent);
  color: var(--text-main) !important;
  font-weight: 700;
  border-radius: var(--radius-pill);
}

.submit-cta:hover {
  background: var(--accent-hover) !important;
  transform: translateY(-1px);
}

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 72px 24px 40px;
  max-width: 720px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid rgba(59, 130, 246, 0.15);
  margin-bottom: 24px;
  animation: containerShow 0.7s var(--ease-smooth) both;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 8px;
  animation: containerShow 0.7s var(--ease-smooth) 0.1s both;
}

.hero-title-line {
  display: block;
}

.hero-title-accent {
  background: linear-gradient(135deg, var(--accent), #93c5fd, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  margin-bottom: 12px;
  animation: containerShow 0.7s var(--ease-smooth) 0.15s both;
}

.hero-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  animation: containerShow 0.7s var(--ease-smooth) 0.2s both;
}

/* --- Controls --- */
.controls {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: containerShow 0.7s var(--ease-smooth) 0.25s both;
}

.search-wrapper {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

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

.search-input {
  width: 100%;
  padding: 12px 16px 12px 46px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-main);
  transition: all 0.2s var(--ease-out);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* --- Category tabs (segmented toggle) --- */
.category-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
  margin: 0 auto;
  width: fit-content;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s var(--ease-out);
  position: relative;
  white-space: nowrap;
}

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

.tab.active {
  color: var(--text-main);
  background: var(--bg-elevated);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.tab-count {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
}

.tab.active .tab-count {
  background: var(--accent-glow);
  color: var(--accent-hover);
}

/* --- Toolbar (sort + filters) --- */
.toolbar {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 20px;
  animation: containerShow 0.5s var(--ease-smooth) both;
}

.toolbar.hidden {
  display: none;
}

.toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.sort-select {
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 32px 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a1a1aa' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.sort-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  font-family: var(--font);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  white-space: nowrap;
}

.chip:hover {
  color: var(--text-secondary);
  border-color: var(--border);
}

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

/* --- Grid --- */
.grid-section {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

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

/* --- Card base --- */
.card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all 0.3s var(--ease-out);
  animation: cardFadeIn 0.5s var(--ease-smooth) both;
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.6);
}

.card:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* Staggered card animation */
.card:nth-child(1) { animation-delay: 0.02s; }
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.06s; }
.card:nth-child(4) { animation-delay: 0.08s; }
.card:nth-child(5) { animation-delay: 0.10s; }
.card:nth-child(6) { animation-delay: 0.12s; }
.card:nth-child(7) { animation-delay: 0.14s; }
.card:nth-child(8) { animation-delay: 0.16s; }
.card:nth-child(9) { animation-delay: 0.18s; }

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

.card-name {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.card-version {
  font-size: 0.65rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

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

.card-author {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.card-author::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #93c5fd);
  flex-shrink: 0;
}

/* --- Mode section label --- */
.mode-label {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
}

/* --- Color palette strip --- */
.palette-strip {
  display: flex;
  gap: 4px;
  width: 100%;
}

.palette-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
}

.palette-swatch {
  width: 100%;
  height: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.2s var(--ease-spring), box-shadow 0.2s var(--ease-out);
  cursor: default;
}

.palette-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 1;
}

.palette-mode-name {
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

/* --- Feature badges --- */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 700;
  border: 1px solid transparent;
}

/* CSS — green */
.badge--css {
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.2);
  background: rgba(16, 185, 129, 0.1);
}

/* Canvas FX — orange */
.badge--fx {
  color: #fdba74;
  border-color: rgba(251, 146, 60, 0.2);
  background: rgba(251, 146, 60, 0.1);
}

/* Gradient — pink */
.badge--gradient {
  color: #f9a8d4;
  border-color: rgba(244, 114, 182, 0.2);
  background: rgba(244, 114, 182, 0.1);
}

/* Overrides — purple */
.badge--overrides {
  color: #c4b5fd;
  border-color: rgba(147, 51, 234, 0.2);
  background: rgba(147, 51, 234, 0.1);
}

/* Gradient types */
.badge--linear {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.2);
  background: rgba(52, 211, 153, 0.08);
}

.badge--radial {
  color: #f97316;
  border-color: rgba(249, 115, 22, 0.2);
  background: rgba(249, 115, 22, 0.08);
}

.badge--mesh {
  color: #e879f9;
  border-color: rgba(232, 121, 249, 0.2);
  background: rgba(232, 121, 249, 0.08);
}

.badge--animated {
  color: #22d3ee;
  border-color: rgba(34, 211, 238, 0.2);
  background: rgba(34, 211, 238, 0.08);
  animation: badgePulse 2.5s ease-in-out infinite;
}

/* Modes badge */
.badge--modes {
  color: var(--accent-hover);
  border-color: rgba(59, 130, 246, 0.2);
  background: var(--accent-subtle);
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

/* --- Gradient preview --- */
.gradient-preview {
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}

/* --- Canvas FX visual --- */
.fx-visual {
  height: 48px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.15),
    rgba(147, 197, 253, 0.1),
    rgba(244, 114, 182, 0.12),
    rgba(34, 211, 238, 0.1)
  );
  background-size: 300% 300%;
  animation: fxShimmer 8s ease-in-out infinite;
}

.fx-visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 30%,
    rgba(255, 255, 255, 0.03) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: fxShine 4s ease-in-out infinite;
}

@keyframes fxShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

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

/* --- Bundle card highlight --- */
.card--bundle {
  border-color: rgba(59, 130, 246, 0.15);
  background: var(--bg-surface);
}

.card--bundle::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.04),
    transparent 60%
  );
  pointer-events: none;
}

.card--bundle:hover {
  border-color: var(--accent);
  box-shadow:
    0 10px 20px -5px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(59, 130, 246, 0.2);
}

.bundle-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

/* --- Copy button (pill) --- */
.copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-out);
  margin-top: auto;
  width: 100%;
}

.copy-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.copy-btn:active {
  transform: scale(0.97);
}

.copy-btn.copied {
  background: var(--success);
  border-color: var(--success);
  color: white;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.4);
}

.copy-btn svg {
  flex-shrink: 0;
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.empty-icon {
  opacity: 0.3;
}

.hidden {
  display: none !important;
}

/* --- Loading --- */
.loading-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* --- Toast (pill) --- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
  z-index: 200;
  opacity: 0;
  transition: all 0.4s var(--ease-spring);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Footer --- */
.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 32px 24px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.78rem;
}

.site-footer a {
  color: var(--accent-hover);
  font-weight: 600;
  transition: color 0.2s var(--ease-out);
}

.site-footer a:hover {
  color: var(--accent);
}

/* --- Animations --- */
@keyframes containerShow {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* --- Detail modal --- */
.detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease-out), visibility 0.3s;
  padding: 24px;
}

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

.detail-panel {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 580px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.96);
  transition: transform 0.4s var(--ease-smooth);
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

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

.detail-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s var(--ease-out);
  z-index: 1;
}

.detail-close:hover {
  color: var(--text-main);
  border-color: var(--text-muted);
  transform: scale(1.1);
}

/* Detail inner layout */
.detail-title {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  padding-right: 44px;
  margin-bottom: 4px;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.detail-version {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.detail-author {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.detail-author::before {
  content: '';
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #93c5fd);
  flex-shrink: 0;
}

.detail-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
}

.detail-section-label {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.detail-palette {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.detail-mode-card {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-mode-swatch {
  width: 100%;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-mode-name {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-align: center;
}

.detail-mode-values {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  text-align: center;
  opacity: 0.7;
}

.detail-mode-features {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.detail-import-url {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  word-break: break-all;
  line-height: 1.5;
  user-select: all;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero {
    padding: 52px 20px 28px;
  }

  .hero-title {
    font-size: 2.2rem;
  }

  .hero-subtitle {
    font-size: 1.15rem;
  }

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

  .category-tabs {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .category-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab {
    padding: 8px 12px;
    font-size: 0.75rem;
  }

  .tab svg {
    display: none;
  }

  .header-link span {
    display: none;
  }

  .header-link {
    padding: 8px;
  }

  .controls {
    padding: 0 16px 20px;
  }

  .grid-section {
    padding: 0 16px 64px;
  }

  .toolbar {
    padding: 0 16px 16px;
  }

  .filter-chips {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .filter-chips::-webkit-scrollbar {
    display: none;
  }
}

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

  .hero-title {
    font-size: 1.8rem;
  }

  .card {
    padding: 16px;
  }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .detail-overlay {
    padding: 12px;
  }

  .detail-panel {
    padding: 24px;
    max-height: 90vh;
  }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-deep);
}

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

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

/* --- Selection --- */
::selection {
  background: var(--accent);
  color: white;
}

/* ============ Live Preview Overlay ============ */

.preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  background: var(--bg-deep);
  display: none;
}

.preview-overlay.open {
  display: block;
  animation: previewFadeIn 0.25s var(--ease-out);
}

@keyframes previewFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.preview-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.preview-stage .preview-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.preview-stage .preview-gradient-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.preview-stage .preview-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 1;
  background: transparent;
}

@keyframes tdp-preview-gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.preview-topbar {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: calc(100vw - 32px);
  padding: 8px 10px 8px 16px;
  background: color-mix(in srgb, var(--bg-surface) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.preview-titlebox {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.preview-label {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  background: var(--accent-subtle);
  border: 1px solid var(--accent-glow);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.preview-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 30vw;
}

/* Narrow screens: let the toolbar wrap instead of overflowing. The mock is
   told the resulting height over postMessage, so it stays clear either way. */
@media (max-width: 767px) {
  /* Small screens keep only what is interactive: the mode pills and the
     close button. Badge, title, and hints are stripped, so the bar shrinks
     to one compact pill and barely covers the mock. Its real height still
     reaches the mock over the inset handshake. */
  .preview-topbar {
    top: 8px;
    max-width: calc(100vw - 16px);
    gap: 8px;
    padding: 5px 6px;
  }

  .preview-titlebox,
  .preview-hint,
  .preview-context,
  .preview-scale {
    display: none;
  }

  .preview-close {
    width: 30px;
    height: 30px;
  }
}

.preview-controls-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-pills {
  display: flex;
  gap: 4px;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.preview-pill {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.preview-pill:hover {
  color: var(--text-main);
}

.preview-pill.active {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.preview-hint {
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.preview-context {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.preview-context input[type='range'] {
  width: 110px;
  accent-color: var(--accent);
}

/* Open WebUI's UI Scale slider, embedded in the preview pill */
.preview-scale {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.preview-scale input[type='range'] {
  width: 90px;
  accent-color: var(--accent);
}

.preview-scale output {
  min-width: 30px;
  font-variant-numeric: tabular-nums;
}

.preview-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s var(--ease-spring);
}

.preview-close:hover {
  background: var(--border);
  transform: scale(1.08);
}

.preview-status {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: none;
  max-width: min(560px, calc(100vw - 40px));
  padding: 10px 18px;
  background: color-mix(in srgb, var(--bg-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-align: center;
}

.preview-status.visible {
  display: block;
}

.preview-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent-glow);
  background: var(--accent-subtle);
  color: var(--accent-hover);
  font-family: var(--font);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.preview-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}

.card-actions {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.card-actions .copy-btn {
  flex: 1;
}

/* (The old ≤640px full-width topbar block lived here. It pinned left/right
   to 16px, which stretched the bar edge-to-edge and overrode the ≤767px
   compact-pill rules above — the bar now stays shrink-to-fit everywhere.) */
