/* ═══════════════════════════════════════════════════════════════════════════
   STUD LOGIX — Visual Harmony System v2.0
   ═══════════════════════════════════════════════════════════════════════════
   Universal CSS fixes applied to ALL pages:
   1. Zero-Overlap Rule — z-index stacking system
   2. Legibility Upgrade — contrast fixes + glass-blur for text on white
   3. Golden Spacing Rule — consistent p-8 padding on containers
   4. Eye-Pleasing Geometry — rounded-2xl cards, shadow-sm
   5. Button Active States — visual feedback on every click
   6. Responsive Overlap Prevention — flex-col + gap-12 stacking
   7. Toast Notification — login prompts, feedback
   8. Emerald Precision Palette — canonical colour tokens
   9. Detail-Page Overlap Fix — sections never collide
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── 1. Z-INDEX STACKING SYSTEM ───────────────────────────────────────────── */
header[class*="sticky"], nav[class*="sticky"] {
  z-index: 50 !important;
  position: sticky;
}
.notif-badge, .cart-count {
  z-index: 5;
}
[class*="brick-float"], .particle-grid, .particle, .ticker-glow {
  z-index: 0 !important;
  pointer-events: none;
}
[class*="lightbox"], [class*="modal"], .fixed.inset-0 {
  z-index: 999;
}
.toast, [role="alert"], [id*="toast"] {
  z-index: 1000;
}


/* ── 2. LEGIBILITY UPGRADE — Contrast & Glass Blur ────────────────────────── */
footer a, footer p, footer span,
.text-\[\#64748B\],
[class*="text-on-surface-variant"] {
  color: #475569 !important;
}
/* Canonical brand colors — force correct values, not "revert" */
.text-primary,
[class*="text-primary"]:not([class*="text-on-primary"]) {
  color: #006a28 !important;
}
.text-on-primary,
[class*="text-on-primary"],
.bg-primary > *,
button.bg-primary,
a.bg-primary,
button[class*="bg-primary"]:not([class*="bg-primary/"]):not([class*="bg-primary-container"]),
a[class*="bg-primary"]:not([class*="bg-primary/"]):not([class*="bg-primary-container"]) {
  color: #ffffff !important;
}
/* Preserve white text inside primary-colored buttons even with nested spans */
button.bg-primary *, a.bg-primary *,
button[class*="bg-primary"]:not([class*="bg-primary/"]):not([class*="bg-primary-container"]) *,
a[class*="bg-primary"]:not([class*="bg-primary/"]):not([class*="bg-primary-container"]) * {
  color: inherit;
}
.text-error, [class*="text-error"] { color: #b02500 !important; }
.text-white { color: #ffffff !important; }

.glass-text-bg {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 4px 10px;
  border-radius: 8px;
}
[class*="opacity-40"], [class*="opacity-30"], [class*="opacity-20"] {
  opacity: 0.6 !important;
}
.dark footer a, .dark footer p, .dark footer span,
.dark [class*="text-on-surface-variant"] {
  color: #94a3b8 !important;
}


/* ── 3. GOLDEN SPACING RULE — Consistent Container Padding (p-8) ─────────── */
.bg-surface-container,
.bg-surface-container-low,
.bg-surface-container-high,
.bg-surface-container-lowest,
[class*="bg-surface-container"] {
  padding: clamp(1.5rem, 5vw, 2rem);
}
/* Don't force padding on structural flex/grid containers */
.bg-surface-container.flex,
.bg-surface-container.grid,
[class*="bg-surface-container"].flex,
[class*="bg-surface-container"].grid {
  padding: unset;
}

.sl-card {
  padding: 2rem;
  border-radius: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.sl-card > *:first-child { margin-top: 0; }
.sl-card > *:last-child  { margin-bottom: 0; }


/* ── 4. EYE-PLEASING GEOMETRY — Standardized Radius & Shadows ─────────────── */
[class*="shadow-md"], [class*="shadow-lg"], [class*="shadow-xl"] {
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04) !important;
}
[class*="shadow-md"]:hover, [class*="shadow-lg"]:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}
.dark [class*="shadow-md"], .dark [class*="shadow-lg"], .dark [class*="shadow-xl"] {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}


/* ── 5. BUTTON ACTIVE STATES — Visual Feedback on Every Click ─────────────── */
/* Scoped to a/button only — never body/div/main/section/header/footer */
a.bg-primary,
button.bg-primary,
a[class*="bg-primary-container"],
button[class*="bg-primary-container"] {
  transition: all 0.18s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
}
.bg-primary:active, a.bg-primary:active, button.bg-primary:active {
  transform: scale(0.95) !important;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.2) !important;
}
button:not(.bg-primary):not([disabled]),
a[class*="border"]:not(.bg-primary) {
  transition: all 0.15s ease;
}
button:not(.bg-primary):not([disabled]):active {
  transform: scale(0.97);
  opacity: 0.85;
}
button[disabled], [disabled] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none !important;
}
button[class*="rounded-full"]:active,
a[class*="rounded-full"]:active {
  transform: scale(0.88);
}
input[type="radio"]:checked + span,
input[type="checkbox"]:checked + span {
  color: #006a28;
  font-weight: 700;
}


/* ── 6. RESPONSIVE — eBay-inspired mobile-first layout ───────────────────── */
/* Filter toggle: hidden on desktop */
.sl-filter-toggle { display: none !important; }

.relative {
  isolation: isolate;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE LAYOUT — eBay-inspired: clean, minimal, tight, readable
   Targets < 768px. Uses element/attribute selectors to avoid escaped-bracket
   Tailwind specificity issues that caused "glitchy" text.
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {

  /* ── A. GLOBAL TYPOGRAPHY RESET ──────────────────────────────────────────
     Force all headings/text to sane mobile sizes. This overrides any
     inline Tailwind arbitrary values like text-[48px], text-[64px] etc.
  */
  h1 { font-size: 24px !important; line-height: 1.15 !important; }
  h2 { font-size: 20px !important; line-height: 1.2 !important; }
  h3 { font-size: 17px !important; line-height: 1.25 !important; }
  h4 { font-size: 15px !important; line-height: 1.3 !important; }
  h5, h6 { font-size: 14px !important; line-height: 1.35 !important; }
  p, li, span, a, label, td, th, div {
    max-width: 100vw;
    overflow-wrap: break-word;
    word-break: break-word;
  }

  /* ── B. GLOBAL SPACING — compact like eBay ──────────────────────────────
     eBay mobile uses 12-16px side padding, tight vertical rhythm.
  */
  body {
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
  }

  /* Override any px-8 (32px) padding to mobile-friendly 14px */
  section, main, footer {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  /* Constrain max-width containers */
  [class*="max-w-"] {
    max-width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  /* ── C. HEADER — eBay-style compact bar ─────────────────────────────────
     Sticky, thin, just logo + burger + key icons.
  */
  header {
    position: sticky !important;
    top: 0;
    z-index: 50;
    padding: 0 !important;
  }
  header > div,
  header > .flex,
  header .flex {
    padding: 8px 12px !important;
    gap: 8px !important;
  }
  /* Hide desktop nav links on mobile */
  header nav,
  header [class*="hidden md:flex"],
  header [class*="hidden lg:flex"] {
    display: none !important;
  }
  /* Compact header logo */
  header a[class*="text-xl"],
  header a[class*="text-lg"] {
    font-size: 16px !important;
  }
  /* Keep icon buttons compact */
  header button,
  header a[class*="rounded-full"],
  header a[class*="rounded-lg"] {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  header .material-symbols-outlined {
    font-size: 20px !important;
  }
  /* Hide "Sell Now" text button on header, bottom nav has it */
  header a[href*="create_a_listing"] {
    display: none !important;
  }
  /* Make LEGO History badge compact */
  header div[class*="flex-col"][class*="leading-none"] {
    display: none !important;
  }

  /* ── D. HERO SECTION — clean, short, no clutter ─────────────────────────
     eBay keeps hero short with search-first approach.
  */
  .hero-gradient,
  section[class*="hero-gradient"] {
    padding: 32px 16px 28px !important;
    min-height: auto !important;
  }
  /* Hide floating brick SVGs on mobile — eBay-clean */
  .brick-float,
  .brick-float-2,
  .brick-float-3,
  svg[class*="brick-float"] {
    display: none !important;
  }
  /* Hero heading — eBay style: max 24px, tight */
  .hero-gradient h1,
  section[class*="hero-gradient"] h1 {
    font-size: 22px !important;
    line-height: 1.2 !important;
    letter-spacing: -0.01em !important;
    margin-bottom: 10px !important;
  }
  .hero-gradient p,
  section[class*="hero-gradient"] p {
    font-size: 13px !important;
    line-height: 1.4 !important;
    margin-bottom: 14px !important;
  }
  /* Hero CTA buttons — full width, stacked */
  .hero-gradient .flex[class*="gap"],
  section[class*="hero-gradient"] .flex[class*="gap"] {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100%;
  }
  .hero-gradient a[class*="rounded"],
  .hero-gradient button[class*="rounded"],
  section[class*="hero-gradient"] a[class*="rounded"],
  section[class*="hero-gradient"] button[class*="rounded"] {
    width: 100% !important;
    text-align: center;
    justify-content: center;
    padding: 12px 16px !important;
    font-size: 14px !important;
  }
  /* Hide particle grid on mobile */
  .particle-grid {
    display: none !important;
  }

  /* ── E. FEATURED LISTING CARD in hero — compact ─────────────────────────
  */
  .hero-gradient [class*="absolute"][class*="right"] {
    position: relative !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 16px;
  }

  /* ── F. SECTION HEADINGS — eBay uses 16-18px bold ───────────────────────
  */
  section h2 {
    font-size: 18px !important;
    margin-bottom: 12px !important;
  }
  section h2 + p,
  section h2 ~ p:first-of-type {
    font-size: 13px !important;
  }
  /* Section vertical padding — tight */
  section {
    padding-top: 20px !important;
    padding-bottom: 20px !important;
  }

  /* ── G. PRODUCT CARD GRIDS — 2 columns, eBay-style ─────────────────────
     eBay uses 2-col grid with ~8px gap, small thumbnails, max 2-line titles.
  */
  [class*="grid-cols-3"],
  [class*="grid-cols-4"],
  [class*="grid-cols-5"],
  [class*="grid-cols-6"],
  [class*="grid-cols-8"],
  [class*="grid-cols-10"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  /* Single-column grids stay single */
  [class*="grid-cols-1"]:not([class*="sm:grid-cols"]):not([class*="lg:grid-cols"]) {
    grid-template-columns: 1fr !important;
  }
  /* Responsive grids that start at 1 go to 2 on mobile */
  [class*="grid-cols-1"][class*="sm:grid-cols-2"],
  [class*="grid-cols-1"][class*="lg:grid-cols"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Card styling — eBay: white bg, thin border, small radius */
  .card-hover-lift,
  [class*="rounded-2xl"][class*="shadow"],
  [class*="rounded-xl"][class*="shadow"],
  [class*="rounded-3xl"][class*="shadow"] {
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
    overflow: hidden;
  }
  /* Disable hover lift on mobile — tap, don't hover */
  .card-hover-lift:hover {
    transform: none !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
  }

  /* Card images — square aspect ratio like eBay */
  .card-hover-lift img,
  [id*="grid"] img,
  [id*="results"] img {
    aspect-ratio: 1/1;
    object-fit: contain;
    width: 100%;
    border-radius: 0 !important;
  }

  /* Card text — eBay: 13px title (2 lines max), 14px bold price */
  .card-hover-lift h3,
  .card-hover-lift [class*="font-bold"],
  [id*="grid"] h3 {
    font-size: 13px !important;
    line-height: 1.3 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Card padding — compact */
  .card-hover-lift > div:last-child,
  .card-hover-lift [class*="p-4"],
  .card-hover-lift [class*="p-5"],
  .card-hover-lift [class*="p-6"] {
    padding: 8px 10px !important;
  }

  /* ── H. MARQUEE / TICKER — smaller text ─────────────────────────────────
  */
  .animate-marquee {
    font-size: 11px !important;
  }
  .animate-marquee span {
    font-size: 11px !important;
    padding: 0 12px !important;
  }

  /* ── I. MARKET PULSE / CHART SECTION — compact ──────────────────────────
  */
  canvas {
    max-height: 200px !important;
  }

  /* ── J. HOW IT WORKS — single column ────────────────────────────────────
  */
  .step-connector {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .step-connector::before {
    display: none !important;
  }
  .step-number {
    width: 56px !important;
    height: 56px !important;
    font-size: 1.4rem !important;
    margin-bottom: 12px !important;
  }
  .step-card {
    padding: 16px !important;
  }

  /* ── K. CTA BANNER — full width, less padding ──────────────────────────
  */
  [class*="rounded-[2.5rem]"][class*="bg-primary"] {
    border-radius: 16px !important;
    padding: 24px 16px !important;
  }
  [class*="rounded-[2.5rem]"] h2 {
    font-size: 20px !important;
  }
  [class*="rounded-[2.5rem]"] .material-symbols-outlined[style*="300px"] {
    font-size: 120px !important;
  }

  /* ── L. FOOTER — single column, tight ───────────────────────────────────
  */
  footer {
    padding: 20px 14px !important;
  }
  footer [class*="grid-cols-3"],
  footer [class*="grid"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  footer h4 {
    font-size: 13px !important;
    margin-bottom: 8px !important;
  }
  footer li, footer a, footer p {
    font-size: 13px !important;
  }

  /* ── M. SEARCH/BROWSE PAGE — collapsible filters ────────────────────────
  */
  .sl-filter-toggle {
    display: flex !important;
  }
  /* Hide sidebar by default on mobile */
  aside[class*="w-72"],
  aside.w-72 {
    display: none !important;
    width: 100% !important;
    max-width: 100% !important;
    position: relative !important;
  }
  aside.sl-filters-open {
    display: block !important;
  }

  /* Search results — 2 col */
  #results-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  /* Recently viewed — 3 small thumbnails */
  #recently-viewed-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  /* Sort/filter bar — full width */
  [class*="justify-between"][class*="items-center"] select,
  #sort-select {
    font-size: 12px !important;
    padding: 8px 10px !important;
  }

  /* ── N. INDIVIDUAL LISTING / DETAIL PAGES — stacked layout ──────────────
  */
  /* Image gallery — full width */
  [class*="grid-cols-2"][class*="gap"] img[class*="col-span"] {
    grid-column: span 2 !important;
  }
  /* Price on detail pages — prominent */
  [class*="text-3xl"][class*="font-black"],
  [class*="text-2xl"][class*="font-black"] {
    font-size: 22px !important;
  }
  /* Action buttons full width */
  main button[class*="py-4"],
  main a[class*="py-4"] {
    width: 100% !important;
    padding: 14px 16px !important;
    font-size: 15px !important;
  }

  /* ── O. FORMS — full width inputs, 44px touch targets ───────────────────
  */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select {
    font-size: 16px !important; /* prevents iOS zoom */
    min-height: 44px;
    width: 100%;
    border-radius: 8px !important;
  }
  button, a[role="button"], [type="submit"] {
    min-height: 44px;
  }

  /* ── P. VAULT / DASHBOARD — stacked cards ───────────────────────────────
  */
  [class*="grid-cols-2"][class*="md:grid-cols-4"],
  [class*="grid-cols-2"][class*="lg:grid-cols-4"] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }
  /* Stats cards — smaller text */
  [class*="grid"] [class*="rounded"][class*="p-5"],
  [class*="grid"] [class*="rounded"][class*="p-6"] {
    padding: 12px !important;
  }

  /* ── Q. TABLE RESPONSIVENESS ────────────────────────────────────────────
  */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: 12px;
  }
  th, td {
    padding: 8px 10px !important;
    white-space: nowrap;
  }

  /* ── R. MODAL / DIALOG — full screen on mobile ──────────────────────────
  */
  [class*="fixed"][class*="inset-0"] > [class*="rounded"][class*="max-w"],
  [class*="fixed"][class*="z-"] > [class*="bg-white"][class*="rounded"] {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  /* ── S. ANIMATIONS — reduce motion on mobile for performance ────────────
  */
  .brick-float, .brick-float-2, .brick-float-3 { display: none !important; }
  .button-pulse::after { animation: none !important; }
  .card-hover-lift { transition: none !important; }
  .step-card:hover { transform: none !important; box-shadow: none !important; }

  /* ── T. SPACING OVERRIDES — tighten all gaps ────────────────────────────
  */
  [class*="gap-12"] { gap: 16px !important; }
  [class*="gap-10"] { gap: 14px !important; }
  [class*="gap-8"] { gap: 12px !important; }
  [class*="gap-6"] { gap: 10px !important; }
  [class*="py-24"] { padding-top: 20px !important; padding-bottom: 20px !important; }
  [class*="py-20"] { padding-top: 18px !important; padding-bottom: 18px !important; }
  [class*="py-16"] { padding-top: 16px !important; padding-bottom: 16px !important; }
  [class*="pb-32"] { padding-bottom: 20px !important; }
  [class*="pt-20"] { padding-top: 16px !important; }

  /* ── U. FLEX LAYOUTS — stack on mobile ──────────────────────────────────
  */
  main > .flex[class*="gap"],
  section > .flex[class*="gap"] {
    flex-direction: column !important;
  }
  /* Keep inline flex items that should stay horizontal */
  [class*="items-center"][class*="gap-2"],
  [class*="items-center"][class*="gap-1"],
  [class*="items-center"][class*="gap-3"] {
    flex-direction: row !important;
  }

  /* ── V. DARK MODE MOBILE ────────────────────────────────────────────────
  */
  .dark header { background: rgba(15,23,42,0.97) !important; }
  .dark footer { background: #0f172a !important; }

  /* ── W. BOTTOM NAV CLEARANCE ────────────────────────────────────────────
  */
  body {
    padding-bottom: 72px !important;
  }
  .sl-toast {
    bottom: 80px !important;
  }

  /* ── W2. ITEM PROFILE & BUILD COMPONENTS — mobile grid fixes ────────────
  */
  [class*="lg:grid-cols-6"].divide-x {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  [class*="lg:grid-cols-6"].divide-x > div {
    border-right: none !important;
  }
  #components-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  #components-grid a {
    padding: 8px !important;
  }
  #components-grid .text-\[11px\] {
    font-size: 10px !important;
  }

  /* ── X. OVERFLOW PREVENTION ─────────────────────────────────────────────
  */
  * {
    max-width: 100vw;
  }
  body, html {
    overflow-x: hidden !important;
  }
  img, video, iframe, canvas, svg {
    max-width: 100% !important;
    height: auto;
  }

  /* ── Y. INBOX / MESSAGES — full width cards ─────────────────────────────
  */
  [class*="divide-y"] > div,
  [class*="divide-y"] > a {
    padding: 12px 0 !important;
  }

  /* ── Z. CART / CHECKOUT — stacked layout ────────────────────────────────
  */
  [class*="lg:grid-cols-3"] {
    grid-template-columns: 1fr !important;
  }
  [class*="lg:col-span-2"],
  [class*="col-span-2"] {
    grid-column: span 1 !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   SMALL PHONES (< 380px) — extra tight
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 379px) {
  h1 { font-size: 20px !important; }
  h2 { font-size: 17px !important; }
  section { padding-left: 10px !important; padding-right: 10px !important; }

  [class*="grid-cols-2"] {
    gap: 6px !important;
  }

  .step-connector {
    gap: 12px !important;
  }
  .step-number {
    width: 44px !important;
    height: 44px !important;
    font-size: 1.1rem !important;
  }
}


/* ── 7. TOAST NOTIFICATION ────────────────────────────────────────────────── */
.sl-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  background: #1e293b;
  color: white;
  padding: 14px 28px;
  border-radius: 1rem;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sl-toast.visible {
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.sl-toast .sl-toast-icon {
  font-size: 18px;
  color: #5cfd80;
}


/* ── 8. EMERALD PRECISION PALETTE ENFORCEMENT ─────────────────────────────── */
:root {
  --sl-emerald: #006a28;
  --sl-emerald-light: #5cfd80;
  --sl-emerald-surface: rgba(0, 106, 40, 0.06);
  --sl-surface: #f7f5ff;
  --sl-text: #2d2e36;
  --sl-text-secondary: #475569;
  --sl-border: #adacb6;
  --sl-error: #b02500;
}


/* ── 9. DETAIL PAGE OVERLAP FIX ───────────────────────────────────────────── */
/* Ensure sections on detail pages stack cleanly with gap-12 spacing */
main > section + section,
main > div > section + section {
  margin-top: 3rem;
}
/* Prevent grid children from overflowing and causing overlap */
.grid > * {
  min-width: 0;
}


/* ── 10. GLASS BLUR CONTRAST OVERLAY ─────────────────────────────────────── */
/* Ensure text over white/light backgrounds never blends in */

/* Buttons that sit over images (I Own This, Wishlist, Alert) */
[data-action="add-collection"],
button[id*="wanted"],
button[id*="wishlist"],
button[id*="alert"] {
  backdrop-filter: blur(8px) saturate(1.3);
  -webkit-backdrop-filter: blur(8px) saturate(1.3);
  background: rgba(255, 255, 255, 0.85) !important;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Text badges overlaying light backgrounds */
.absolute [class*="font-bold"],
.absolute [class*="font-black"] {
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.7);
}

/* Generic glass overlay helper — apply to any text sitting on white */
.sl-glass-overlay {
  backdrop-filter: blur(12px) saturate(1.4);
  -webkit-backdrop-filter: blur(12px) saturate(1.4);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(0, 0, 0, 0.04);
}
.dark .sl-glass-overlay {
  background: rgba(15, 23, 42, 0.7);
  border-color: rgba(255, 255, 255, 0.04);
}


/* ══════════════════════════════════════════════════════════════════════════
   v1.2 — HUMAN-POLISH FIXES (reduce AI-generated look)
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 11. CARD LAYOUT STABILITY — title/price rows never overlap ─────────── */
/* Any flex row containing an h1/h2/h3/h4 + a price/badge should be stable */
.flex.justify-between > h1,
.flex.justify-between > h2,
.flex.justify-between > h3,
.flex.justify-between > h4,
.flex.justify-between > div:has(h1, h2, h3, h4) {
  min-width: 0;
}
/* Price/badge elements shouldn't shrink when space is tight */
.flex.justify-between > [class*="font-black"],
.flex.justify-between > [class*="font-bold"]:last-child:not(div) {
  flex-shrink: 0;
}

/* Long titles in cards truncate cleanly */
.max-w-sm h3:not(.truncate),
.max-w-md h3:not(.truncate),
.max-w-xs h3:not(.truncate) {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── 12. STABLE FONT WEIGHTS — stop mixing font-black with thin fonts ─── */
/* Inter renders font-black (900) poorly on small text; cap to 800 below 16px */
[class*="text-xs"][class*="font-black"],
[class*="text-sm"][class*="font-black"] {
  font-weight: 800;
}

/* ── 13. INPUT/TEXTAREA POLISH ──────────────────────────────────────────── */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="search"], input[type="url"], textarea {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}
input::placeholder, textarea::placeholder {
  color: #94a3b8 !important;
  opacity: 1;
  font-weight: 400;
  font-style: normal;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0, 106, 40, 0.12) !important;
}

/* ── 14. BUTTON TEXT STABILITY — never let button labels wrap weirdly ──── */
button, a[class*="bg-primary"]:not([class*="w-9"]):not([class*="w-10"]):not([class*="w-11"]) {
  white-space: nowrap;
}
/* Exception: multi-line button content (Sell Now with subtitle) */
button.flex-col, a.flex-col {
  white-space: normal;
}

/* ── 15. GRADIENT STABILISATION — no weird colour transitions ─────────── */
/* Force any gradient involving "primary" to use emerald, not random colours */
[class*="from-primary"] {
  --tw-gradient-from: #006a28;
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(0, 106, 40, 0));
}
[class*="to-primary"] {
  --tw-gradient-to: #006a28;
}
[class*="to-secondary"] {
  --tw-gradient-to: #545f73;
}

/* ── 16. CARD HOVER — subtle, not floaty ────────────────────────────── */
[class*="hover:scale-105"]:hover {
  transform: scale(1.02) !important;
}
[class*="hover:scale-110"]:hover {
  transform: scale(1.04) !important;
}
/* Kill jittery infinite animations on main content */
.animate-float {
  animation-duration: 6s !important;
  animation-timing-function: ease-in-out !important;
}

/* ── 17. TEXT OVERFLOW GLOBAL GUARD ────────────────────────────────── */
h1, h2, h3, h4, p, span, a {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ── 18. CONSISTENT BORDER RADIUS — stop mixing 0.25/0.5/0.75/1rem ────── */
.rounded-lg { border-radius: 0.625rem !important; }  /* 10px */
.rounded-xl { border-radius: 0.875rem !important; }  /* 14px */
.rounded-2xl { border-radius: 1.125rem !important; } /* 18px */

/* ── 19. SELL NOW / PRIMARY CTAs — Guarantee white text ────────────── */
a[href*="create_a_listing"].bg-primary,
a[href*="create_a_listing"][class*="bg-primary"],
button.bg-primary,
a.bg-primary {
  color: #ffffff !important;
}
a[href*="create_a_listing"].bg-primary span,
a[href*="create_a_listing"][class*="bg-primary"] span,
button.bg-primary span,
a.bg-primary span {
  color: #ffffff !important;
}


/* ══════════════════════════════════════════════════════════════════════════
   v2.0 — DEEP HUMAN-POLISH LAYER
   Focus: typographic rhythm, spacing scale, dark-mode parity,
          card consistency, form polish, motion subtlety
   ══════════════════════════════════════════════════════════════════════════ */

/* ── 20. TYPOGRAPHIC RHYTHM (Inter font stack + metrics) ─────────────────── */
html {
  font-feature-settings: "kern", "liga", "calt", "ss01";
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.005em;
  line-height: 1.55;
}
/* Headings: tighter tracking, consistent leading */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  letter-spacing: -0.022em;
  line-height: 1.15;
  font-feature-settings: "kern", "liga", "calt", "ss01", "cv11";
}
h1, [class*="text-5xl"], [class*="text-6xl"], [class*="text-7xl"] { letter-spacing: -0.032em; line-height: 1.05; }
h2, [class*="text-4xl"] { letter-spacing: -0.028em; line-height: 1.1; }
h3, [class*="text-3xl"] { letter-spacing: -0.022em; line-height: 1.15; }
h4, [class*="text-2xl"] { letter-spacing: -0.018em; line-height: 1.2; }
[class*="text-xl"] { letter-spacing: -0.012em; line-height: 1.3; }
[class*="text-lg"] { letter-spacing: -0.008em; line-height: 1.4; }
[class*="text-base"], [class*="text-sm"] { letter-spacing: -0.003em; }
[class*="text-xs"], [class*="text-\[10px\]"], [class*="text-\[11px\]"] {
  letter-spacing: 0.002em;
}

/* Tabular numbers for prices & stats — stops wobble between rows */
[class*="font-black"], [class*="font-bold"],
.text-primary + p, .text-primary + span,
[class*="font-mono"] {
  font-variant-numeric: tabular-nums;
}

/* ── 21. SPACING SCALE NORMALIZATION ─────────────────────────────────────── */
/* Non-standard Tailwind padding like py-3.5, py-2.5 — snap to 4px grid */
[class*="py-3\\.5"], .py-3\.5 { padding-top: 0.875rem !important; padding-bottom: 0.875rem !important; }
[class*="px-3\\.5"], .px-3\.5 { padding-left: 0.875rem !important; padding-right: 0.875rem !important; }
[class*="py-2\\.5"], .py-2\.5 { padding-top: 0.625rem !important; padding-bottom: 0.625rem !important; }

/* ── 22. UNIFIED CARD SURFACE (any .bg-white card behaves like a design-system card) ─ */
.bg-white.rounded-2xl, .bg-white.rounded-xl,
.bg-white[class*="shadow"] {
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.06);
}
.dark .bg-white.rounded-2xl, .dark .bg-white.rounded-xl,
.dark .bg-white[class*="shadow"] {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
}

/* ── 23. CONSISTENT SECTION PADDING ─────────────────────────────────────── */
section[class*="py-24"], section[class*="py-20"], section[class*="py-16"] {
  padding-top: clamp(3rem, 7vw, 5.5rem);
  padding-bottom: clamp(3rem, 7vw, 5.5rem);
}

/* ── 24. LINK POLISH — no more default blue, no jumpy underlines ───────── */
a:not([class*="text-"]):not([class*="bg-"]) {
  color: #006a28;
  text-decoration: none;
  transition: color 0.15s ease;
}
a:not([class*="text-"]):not([class*="bg-"]):hover {
  color: #14a84a;
}
a[class*="underline"] {
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}

/* ── 25. FORM FIELD HEIGHT CONSISTENCY ──────────────────────────────────── */
/* All text-like inputs snap to a consistent 44px tap target */
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="search"], input[type="url"], input[type="date"],
select:not([multiple]) {
  min-height: 44px;
  font-size: 15px;
  line-height: 1.4;
}
/* Small utility override when inline-sized */
input[class*="w-12"], input[class*="w-14"], input[class*="w-16"] {
  min-height: unset;
}
textarea {
  font-size: 15px;
  line-height: 1.5;
}

/* ── 26. CHECKBOX / RADIO VISUAL POLISH ─────────────────────────────────── */
input[type="checkbox"], input[type="radio"] {
  accent-color: #006a28;
  cursor: pointer;
}

/* ── 27. DARK-MODE PARITY — catch stray light-mode-only styles ─────────── */
.dark body { color: #e2e8f0; }
.dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6 { color: #f1f5f9; }
.dark .bg-surface, .dark [class*="bg-surface"]:not([class*="dark:bg"]) {
  background-color: #0f172a;
}
.dark .text-\[\#12131A\], .dark [class*="text-[#12131A]"]:not([class*="dark:text"]) {
  color: #f1f5f9 !important;
}
.dark .text-on-surface, .dark [class*="text-on-surface"]:not([class*="dark:text"]) {
  color: #e2e8f0;
}
.dark [class*="border-gray-100"]:not([class*="dark:border"]) {
  border-color: rgba(255, 255, 255, 0.06);
}

/* ── 28. IMAGE AND ICON STABILITY ────────────────────────────────────── */
img { max-width: 100%; height: auto; }
img[loading="lazy"] { background: #f1f5f9; }
.dark img[loading="lazy"] { background: #1e293b; }
.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  vertical-align: middle;
  user-select: none;
}
/* Icon + text baseline alignment */
button > .material-symbols-outlined,
a > .material-symbols-outlined,
span > .material-symbols-outlined {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}

/* ── 29. MOTION SUBTLETY — respect reduced-motion, tame infinite loops ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
[class*="animate-pulse"], [class*="animate-bounce"], [class*="animate-ping"] {
  animation-duration: 2.4s !important;
}

/* ── 30. SCROLLBAR POLISH (webkit + firefox) ────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 106, 40, 0.35) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(0, 106, 40, 0.25);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(0, 106, 40, 0.45); background-clip: padding-box; border: 2px solid transparent; }

/* ── 31. FOOTER UNIFORMITY ─────────────────────────────────────────── */
footer {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}
footer h3, footer h4 {
  font-size: 13px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: #475569 !important;
  margin-bottom: 1rem !important;
}
.dark footer h3, .dark footer h4 { color: #94a3b8 !important; }
footer ul { list-style: none; padding: 0; margin: 0; }
footer ul li { margin-bottom: 0.5rem; }
footer ul a { font-size: 14px; font-weight: 500; line-height: 1.6; }
footer ul a:hover { color: #006a28 !important; }

/* ── 32. HEADER UNIFORMITY ─────────────────────────────────────────── */
header[class*="sticky"] {
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
}
header nav a, header nav button {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.003em;
}

/* ── 33. TABLE POLISH ─────────────────────────────────────────────── */
table {
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}
table th {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #64748b;
}
.dark table th { color: #94a3b8; }

/* ── 34. SELECTION COLOUR ──────────────────────────────────────────── */
::selection { background: rgba(92, 253, 128, 0.55); color: #003b15; }
.dark ::selection { background: rgba(0, 106, 40, 0.7); color: #f0fdf4; }

/* ── 35. HORIZONTAL RULE ────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid rgba(15, 23, 42, 0.08); margin: 1.5rem 0; }
.dark hr { border-top-color: rgba(255, 255, 255, 0.08); }

/* ── 36. FOCUS RING — consistent across all interactive elements ────── */
a:focus-visible, button:focus-visible, [tabindex]:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid #006a28;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ── 37. LABEL POLISH ─────────────────────────────────────────────── */
label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.002em;
  color: #334155;
}
.dark label { color: #cbd5e1; }

/* ── 38. DISABLED STATE — globally dimmed, not opaque ─────────────── */
[disabled], .disabled, [aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── 39. BLOCKQUOTE ───────────────────────────────────────────────── */
blockquote {
  border-left: 3px solid #006a28;
  padding-left: 1rem;
  color: #475569;
  font-style: italic;
}
.dark blockquote { color: #cbd5e1; border-left-color: #5cfd80; }

/* ── 40. KEY AI-TELL KILLERS ──────────────────────────────────────── */
/* Kill the "giant font-black on a chip" look — chips should never use font-black */
[class*="rounded-full"][class*="font-black"][class*="text-xs"],
[class*="rounded-full"][class*="font-black"][class*="text-\[10px\]"],
[class*="rounded-full"][class*="font-black"][class*="text-\[11px\]"] {
  font-weight: 700 !important;
}
/* Soften random drop-shadows on text */
[class*="drop-shadow-2xl"] { filter: drop-shadow(0 4px 6px rgba(0,0,0,0.08)) !important; }
/* Never let a CTA button have a wavy gradient background */
button.bg-primary, a.bg-primary {
  background: #006a28 !important;
}
button.bg-primary:hover, a.bg-primary:hover {
  background: #005420 !important;
}
/* Primary-container buttons get a clean lime background */
button.bg-primary-container, a.bg-primary-container {
  background: #5cfd80 !important;
  color: #003b15 !important;
}
button.bg-primary-container:hover, a.bg-primary-container:hover {
  background: #4be070 !important;
}


/* ═══════════════════════════════════════════════════════════════════════════
   7. RESPONSIVE SCALING — Fill large monitors, don't cap at 1440px
   ═══════════════════════════════════════════════════════════════════════════
   On screens wider than 1536px (2xl), let the layout breathe.
   On ultra-wide (≥1920px), go even wider. The site should feel native
   to whatever screen it's on — not a small laptop view on a 4K monitor.
*/

/* 2xl screens (1536px+): bump max-width to 1680px */
@media (min-width: 1536px) {
  [class*="max-w-[1440px]"],
  .max-w-\[1440px\] {
    max-width: 1680px !important;
  }
  /* Bigger base font for readability on large screens */
  body {
    font-size: 16px;
  }
  /* Wider header content area */
  header > div,
  header > .flex {
    max-width: 1680px !important;
  }
  /* Footer matches */
  footer > div,
  footer > .grid {
    max-width: 1680px !important;
  }
  /* Slightly larger headings on big screens */
  h1 { font-size: clamp(2rem, 2.5vw, 3rem) !important; }
  h2 { font-size: clamp(1.5rem, 2vw, 2.25rem) !important; }
  /* Listing grids: show more columns */
  [class*="lg:grid-cols-4"] {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
  [class*="lg:grid-cols-3"]:not([class*="lg:grid-cols-4"]) {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
}

/* 3xl / ultra-wide screens (1920px+): fill to 92% of viewport */
@media (min-width: 1920px) {
  [class*="max-w-[1440px]"],
  .max-w-\[1440px\] {
    max-width: 92vw !important;
  }
  header > div,
  header > .flex {
    max-width: 92vw !important;
  }
  footer > div,
  footer > .grid {
    max-width: 92vw !important;
  }
  body {
    font-size: 17px;
  }
  /* Even more columns on ultra-wide */
  [class*="lg:grid-cols-4"] {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }
  [class*="lg:grid-cols-3"]:not([class*="lg:grid-cols-4"]) {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
  /* More breathing room */
  main, section {
    padding-left: clamp(2rem, 3vw, 4rem);
    padding-right: clamp(2rem, 3vw, 4rem);
  }
}

/* 4K screens (2560px+): maximum utilization */
@media (min-width: 2560px) {
  [class*="max-w-[1440px]"],
  .max-w-\[1440px\] {
    max-width: 88vw !important;
  }
  header > div, header > .flex,
  footer > div, footer > .grid {
    max-width: 88vw !important;
  }
  body {
    font-size: 18px;
  }
  [class*="lg:grid-cols-4"] {
    grid-template-columns: repeat(8, minmax(0, 1fr)) !important;
  }
  /* Scale up cards and images proportionally */
  .sl-set-table td, .sl-set-table th {
    padding: 12px 16px;
    font-size: 14px;
  }
  .sl-set-table .sl-set-img {
    width: 64px;
    height: 64px;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   8. MOBILE UX POLISH — Fix glitchiness, improve touch targets
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
  /* Prevent horizontal overflow (the #1 cause of "glitchy" feel) */
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    max-width: 100vw !important;
  }

  /* Fix any element that might push wider than viewport */
  *, *::before, *::after {
    max-width: 100vw;
    box-sizing: border-box;
  }

  /* Tables: enable horizontal scroll inside container */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  /* Bigger touch targets on mobile */
  a, button {
    min-height: 44px;
    min-width: 44px;
  }
  /* Exception for inline links within text */
  p a, li a, span a, td a {
    min-height: auto;
    min-width: auto;
  }

  /* Smooth scroll on the whole page */
  html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
  }

  /* Fix grid columns on mobile — never more than 2 cols */
  [class*="grid-cols-4"],
  [class*="grid-cols-5"],
  [class*="grid-cols-6"],
  [class*="lg:grid-cols-4"],
  [class*="lg:grid-cols-3"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  /* Value cards row: 2 columns on mobile, no overflow */
  [class*="sm:grid-cols-5"] {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  /* Chart: full width, no side stat cards */
  [class*="hidden sm:flex"][class*="flex-col"][class*="shrink-0"] {
    display: none !important;
  }

  /* Set lineage table: compact on mobile */
  .sl-set-table td, .sl-set-table th {
    padding: 6px 8px;
    font-size: 12px;
  }
  .sl-set-table .sl-set-img {
    width: 36px;
    height: 36px;
  }

  /* Fix breadcrumb wrapping */
  nav[id*="breadcrumb"] {
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
  }

  /* Detail page image: smaller on mobile */
  [class*="lg:grid-cols-[260px"] {
    grid-template-columns: 1fr !important;
  }
  [class*="lg:grid-cols-[260px"] > div:first-child {
    max-width: 200px;
    margin: 0 auto;
  }

  /* Footer: single column, less padding */
  footer .grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
    padding: 2rem 14px !important;
  }

  /* Prevent images from overflowing */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Fix search bar overflow */
  input[type="text"],
  input[type="search"],
  input[type="email"] {
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Smooth transitions instead of jarring changes */
  * {
    transition-property: background-color, border-color, color, fill, stroke, opacity, box-shadow, transform;
    transition-duration: 0.15s;
    transition-timing-function: ease;
  }
  /* Don't animate layout properties — causes jank */
  *:not(button):not(a) {
    transition-property: background-color, border-color, color, opacity;
  }
}

/* Tablet (768px - 1024px): bridge between mobile and desktop */
@media (min-width: 768px) and (max-width: 1024px) {
  [class*="lg:grid-cols-4"] {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  [class*="lg:grid-cols-[260px"] {
    grid-template-columns: 200px 1fr !important;
  }
}


/* ── 24. CATALOG / PRODUCT IMAGE BRIGHTNESS GUARD ─────────────────────────
   Ensures set / minifigure / part images are never dimmed by an inherited
   opacity or filter, and clears the light "frame" tint behind contained
   product images so colours show fully bright. Reversible (see .bak).      */
img[referrerpolicy="no-referrer"]{ opacity:1 !important; filter:none !important; }
.aspect-\[4\/3\] > img[referrerpolicy="no-referrer"],
.aspect-square > img[referrerpolicy="no-referrer"]{ opacity:1 !important; }
