body {
  background: #0f1113;
}
.bg-thumb {
  min-width: 90px;
  cursor: pointer;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.bg-thumb img {
  height: 80px;
  width: auto;
}
.bg-thumb:hover {
  border-color: #4caf50;
  transform: scale(1.05);
}
.bg-label {
  display: block;
  font-size: 11px;
  margin-top: 4px;
}
#lab-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid #222;
  border-radius: 10px;
  background: #000;
  margin-bottom: 8px;
}
@media (max-width: 768px) {
  #lab-stage {
    height: calc(100dvh - 30px); /* 🔥 subtract header */
    aspect-ratio: unset; /* 🔥 remove constraint */
  }
}
/* 📱 MOBILE */
@media (max-width: 768px) {
  #lab-stage {
    aspect-ratio: 3 / 4;
  }
}

/* 🖥️ DESKTOP */
@media (min-width: 769px) {
  #lab-stage {
    aspect-ratio: 16 / 9;
  }
}
#stage-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  gap: 8px;
  padding: 8px 10px;

  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);

  border-radius: 10px;
  z-index: 50;
}

#stage-toolbar button {
  background: #222;
  color: #fff;
  border: none;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
}

#stage-toolbar button.active {
  background: #4caf50;
}
#stage-toolbar button.highlight {
  box-shadow: 0 0 0 2px rgba(0, 255, 0, 0.6);
  transition: box-shadow 0.2s ease;
}
.toolbar-toggle {
  color: #fff;
  font-size: 13px;
}
#bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 1;
}
/* 🔥 REAL IMAGE */
#bg-image {
  position: absolute;
  top: 50%;
  left: 50%;

  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;

  height: 100%;
  width: auto;
  max-width: none;

  transform: translate(-50%, -50%);
  will-change: transform;
}
#bg-browser-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  display: flex;
  justify-content: center;
  align-items: center;
}

#bg-browser-modal.hidden {
  display: none;
}

.modal-content {
  width: 90%;
  max-width: 900px;
  background: #1b1d1f; /* slightly softer than #222 */
  color: #e6e6e6;
  padding: 15px;
  border-radius: 6px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-instructions,
.modal-bar {
  color: #bbb;
}
#my-bg-section.filtered {
  opacity: 0.6;
}
.control-group label {
  color: #ccc;
}
.bg-thumb.manage-tile {
  border: 1px dashed #555;
  background: rgba(255, 255, 255, 0.03);
}

.bg-thumb.manage-tile .upload-inner {
  font-size: 13px;
}
/* =========================
   UPLOAD TILE
========================= */

.upload-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #121212;
  border: 2px dashed #4caf50;
  color: #4caf50;
  font-weight: 600;
  min-width: 110px;
}

.upload-inner {
  font-size: 13px;
  text-align: center;
}

.upload-tile:hover {
  background: #1a1a1a;
  border-color: #66bb6a;
  transform: scale(1.05);
}
#bg-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #2a2a2a;
}
.more-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
}

.modal-filters {
  position: sticky;
  top: 0;
  background: #1b1d1f;
  z-index: 10;
}
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 10px;
}
.bg-thumb-wrap {
  position: relative;
}

.bg-info-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}

.bg-info-icon:hover {
  background: rgba(0, 0, 0, 0.85);
}
.filter-chip {
  background: #222;
  color: #fff;
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.filter-chip span {
  cursor: pointer;
  opacity: 0.7;
}

.filter-chip span:hover {
  opacity: 1;
}
.control-group {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
/* Labels */
.control-group label {
  color: #ccc;
}
.lab-filter {
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 14px;
  background: #2a2d30;
  color: #fff;
  border: 1px solid #444;
}

.modal-instructions {
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
}
#bg-meta {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
}

.bg-meta-name {
  font-weight: bold;
  margin-bottom: 2px;
}

.bg-meta-details {
  font-size: 12px;
  opacity: 0.85;
}
.bg-thumb.active {
  outline: 2px solid #4caf50;
  transform: scale(1.05);
}
.bg-thumb span {
  display: block;
  font-size: 11px;
  margin-top: 4px;
  color: #ddd; /* 🔥 fix readability */
  line-height: 1.2;
}
.bg-thumb-wrap {
  position: relative;
}

.bg-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 12px;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.7);
}

.bg-badge.private {
  color: #ff9800;
}

.bg-badge.pending {
  color: #ffc107;
}

.bg-badge.public {
  color: #4caf50;
}
.special-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1f2326;
  color: #fff;
  min-width: 90px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #333;
}

.special-tile:hover {
  background: #2a2f33;
  border-color: #555;
}
.modal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
  font-size: 13px;
  color: #555;
}
#browse-bg-btn {
  padding: 8px 12px;
  border-radius: 6px;
  background: #2c3e50;
  color: #fff;
  border: none;
  cursor: pointer;
}

/* 🔥 HARD RESET FOR SLIDER */
.pattern-picker .pattern-card {
  width: 75px;
  min-width: 75px;
  max-width: 75px;

  height: 175px;

  padding: 0;
  overflow: hidden;

  position: relative; /* 🔥 IMPORTANT */

  display: block; /* 🔥 REMOVE FLEX */
}

.pattern-picker .promo-logo-tile .pattern-tile-inner {
  display: flex;
  align-items: center;
  justify-content: center;

  position: relative;
  width: 100%;
  height: 100%;
}
.pattern-picker .promo-logo-text {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;

  text-align: center;

  font-size: 9px;
  line-height: 1.1;

  z-index: 2;
}

.pattern-picker .promo-label {
  opacity: 0.7;
}

.pattern-picker .promo-title {
  font-weight: 600;
}

.pattern-picker .promo-cta {
  color: #7CFC00;
}
.pattern-picker .promo-logo-tile img {
  max-width: 65%;
  max-height: 55%;

  width: auto;
  height: auto;

  object-fit: contain;
}
.pattern-picker .pattern-overlay { 
  position: absolute;
  top: 0;              /* 🔥 move to top */
  left: 0;
  right: 0;

  padding: 6px 4px 8px;

  background: none;

  z-index: 3;
}
.pattern-picker .promo-tile-inner img {
  position: absolute;
  top: 10%;
  left: 0;

  width: 100%;

  object-fit: cover;
  z-index: 1;
}
.pattern-picker .pattern-overlay {
  text-align: center;
}
.pattern-picker .promo-link {
  display: block;
  width: 100%;
  height: 100%;
}
.pattern-picker .pattern-title,
.pattern-picker .pattern-brand {
  display: inline-block;

  background: rgba(0, 0, 0, 0.6);
  padding: 2px 4px;
  margin: 1px 0;

  border-radius: 3px;
}
.pattern-picker .pattern-title {
  font-size: 10px;
  line-height: 1.1;
}

.pattern-picker .pattern-brand {
  font-size: 9px;
  opacity: 0.85;
}
.pattern-picker .pattern-tile-inner {
  position: relative;
  width: 100%;
  height: 100%;
}
/* pattern image */
.pattern-picker .pattern-tile-inner img:first-child {
  position: absolute;
  top: 0;
  left: 0;

  width: 100%;
  height: 100%;
  object-fit: cover;

  z-index: 1;
}
.pattern-picker .pattern-logo {
  position: absolute;
  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  width: 90%;
  height: auto;
  object-fit: contain;

  z-index: 2;
}
.pattern-picker .pattern-tile-inner > img:first-child {
  height: 100%;
  object-fit: cover;
}
.pattern-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}
.pattern-link {
  padding: 2px 4px;
  border-radius: 4px;
}

.pattern-link:hover {
  background: rgba(255, 255, 255, 0.08);
}
#bg-layer,
.pattern-layer {
  will-change: transform;
  transform: translateZ(0);
}
#lab-stage[data-mode="pattern1"] {
  box-shadow: inset 0 0 0 2px rgba(255, 0, 0, 0.5);
}

#lab-stage[data-mode="pattern2"] {
  box-shadow: inset 0 0 0 2px rgba(0, 150, 255, 0.5);
}

#lab-stage[data-mode="bg"] {
  box-shadow: inset 0 0 0 2px rgba(76, 175, 80, 0.5);
}
#controls-toggle {
  text-align: center;
  margin: 10px 0;
}

#toggle-controls {
  padding: 10px 16px;
  font-size: 14px;
  background: #2c3e50;
  color: #fff;
  border: none;
  border-radius: 6px;
}
#lab-controls {
  background: #1a1a1a;
  color: #fff;

  border-top: 1px solid #333;
}

.control-group-mode {
  margin-bottom: 20px;
}

.control-group-mode label {
  font-size: 12px;
  opacity: 0.8;
}

#lab-controls input,
#lab-controls select {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 6px;
}

#lab-controls.collapsed {
  display: none;
}
@media (max-width: 768px) {
  #stage-toolbar {
    padding: 6px 8px;
  }

  #stage-toolbar button {
    padding: 5px 8px;
    font-size: 12px;
  }

  #stage-controls button {
    padding: 5px 8px;
    font-size: 12px;
  }

  #bg-meta {
    font-size: 11px;
    padding: 6px 8px;
  }
}
.control-section {
  margin-bottom: 20px;
}

.control-section label {
  display: block;
  margin: 6px 0;
  font-weight: 600;
}
@media (min-width: 900px) {
  #lab-container {
    max-width: 1100px;
    margin: 0 auto;
  }

  #lab-stage {
    max-height: 600px;
  }
}
#lab-container {
  background: linear-gradient(to bottom, #121416, #0b0b0b);
  min-height: 100vh;
}
#stage-toolbar {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

#stage-toolbar button {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
}

#stage-toolbar button:hover {
  background: rgba(255, 255, 255, 0.2);
}
#stage-toolbar button.active {
  background: #4caf50;
  border-color: #4caf50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.4);
}
.toolbar-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  padding: 4px 8px;
  border-radius: 8px;
}
.toolbar-toggle input {
  margin-right: 4px;
}
.toolbar-left,
.toolbar-right {
  gap: 8px;
}
.control-group-mode {
  display: none;
}

.control-group-mode.active {
  display: block;
}
.panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;

  height: auto;
  max-height: 45dvh; /* 🔥 bigger + dynamic */

  background: rgba(10, 10, 10, 0.2); /* 👈 instead of solid gradient */
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);

  border-top: 1px solid rgba(255, 255, 255, 0.08);

  z-index: 999;

  transform: translateY(100%);
  transition:
    transform 0.2s ease,
    opacity 0.2s ease;

  display: flex;
  flex-direction: column;
}
.panel-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-actions button {
  flex: 1;
  padding: 10px;
  border-radius: 10px;

  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(4px);

  border: 1px solid rgba(255, 255, 255, 0.15);

  color: #fff;
  font-weight: 500;

  transition: all 0.15s ease;
}
.panel-actions button:hover {
  background: rgba(255, 255, 255, 0.18);
}

#action-adjust {
  border-color: #4caf50;
}

#action-change {
  border-color: #2196f3;
}

#action-clear {
  border-color: #ff5252;
}
#panel-back {
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 13px;
}
.panel.active {
  transform: translateY(0);
}
#panel-content button {
  margin-right: 6px;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #222;
  color: #fff;
  border: 1px solid #444;
}
#clear-pattern {
  background: #5c2b2b;
}
#panel-content {
  padding: 10px 12px;
  color: white;
  background: transparent;
  overflow-y: auto;
  overflow-x: hidden;

  -webkit-overflow-scrolling: touch; /* 🔥 smooth iPhone scroll */
}
.panel-strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}
.panel-strip {
  -webkit-overflow-scrolling: touch;
}
.pattern-thumb {
  min-width: 60px;
  height: 110px; /* 🔥 taller */
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pattern-thumb img {
  width: 100%;
  height: 85px;
  object-fit: cover;
}

.pattern-thumb:hover {
  border-color: #666;
}
.pattern-thumb.active {
  border-color: #00c853;
  box-shadow: 0 0 6px rgba(0, 200, 83, 0.5);
}
.pattern-thumb,
.panel-strip .bg-thumb {
  scroll-snap-align: start;
}
.pattern-thumb:active,
.panel-strip .bg-thumb:active {
  transform: scale(0.95);
}
.panel-strip .bg-thumb {
  min-width: 90px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
}
#lab-header {
  height: 34px; /* 🔥 reduced from 48px */
  display: flex;
  align-items: center;
  border-bottom: 1px solid #222;
  background: rgba(0, 0, 0, 0.85); /* 🔥 darker, blends into tool */
  z-index: 10;
}

.lab-header-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px; /* 🔥 reduced */
  width: 100%;
}

.lab-logo-small img {
  height: 20px; /* 🔥 smaller */
  width: auto;
}

.lab-title {
  font-size: 13px; /* 🔥 smaller */
  font-weight: 500;
  margin: 0;
  color: rgba(255, 255, 255, 0.85); /* 🔥 better on dark bg */
}

/* 🔥 Mobile: hide logo */
@media (max-width: 600px) {
  #lab-header {
    height: 30px; /* 🔥 even tighter on small screens */
  }

  .lab-logo-small {
    display: none; /* keep this */
  }

  .lab-title {
    font-size: 12px;
    opacity: 0.8;
  }
}
#pattern-browser-results {
  display: grid;

  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 8px;

  padding: 10px;

  grid-auto-flow: dense;
}
/* =========================
   SLIDER PROMO TILE FIX
========================= */

.promo-card-slider {
  grid-column: span 1 !important;
  width: 100%;
  min-height: 110px;
  padding: 0;
}
/* =========================
   FIX SLIDER PROMO WIDTH
========================= */
.info-btn.share {
  border-color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
}
#share-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
}

#share-modal-content {
  background: #111;
  color: #fff;
  padding: 18px;
  border-radius: 12px;
  width: 340px;
  max-width: 92%;
  position: relative;
}

/* Title */
.share-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* Subtext */
.share-sub {
  font-size: 13px;
  opacity: 0.7;
  margin-bottom: 10px;
}
.cm-modal {
  text-align: center;
}

.cm-modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.cm-modal-sub {
  font-size: 13px;
  color: #666;
  margin-bottom: 10px;
}

.cm-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 10px;
}

.cm-btn {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}

.cm-btn-secondary {
  background: #a9bea1;
  color: #222;
}

.cm-btn-primary {
  background: #2a6cff;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.cm-btn:active {
  transform: scale(0.96);
}
.cm-modal-divider {
  margin: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.cm-modal-banner img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
  display: block;
}
.cm-modal-promo {
  margin-top: 10px;
}

#sale-modal-link {
  display: block;
  margin: 10px auto 0;
}
#sale-modal-content {
  animation: modalFade 0.2s ease;
}

@keyframes modalFade {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.cm-modal-banner {
  margin-top: 8px;
  margin-bottom: 4px;
}

.cm-modal-promo-title {
  display: block;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.cm-modal-promo-title.clickable {
  display: block;
  cursor: pointer;
  text-decoration: underline;
  color: #4caf50;
}

.cm-modal-promo-title.clickable:hover {
  opacity: 0.85;
}
/* Input */
#share-link {
  width: 100%;
  padding: 12px;
  font-size: 15px; /* 🔥 bigger */
  border-radius: 8px;
  border: none;
  margin-bottom: 12px;
}

/* Buttons */
#share-modal-content button {
  width: 100%;
  margin-bottom: 8px;
  padding: 12px;
  border-radius: 10px;
  background: #2f6cff;
  color: #fff;
  border: none;
  font-size: 15px; /* 🔥 bigger */
  font-weight: 500;
}
#open-link-btn {
  background: rgba(255, 255, 255, 0.1);
}
/* Close button */
#share-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 20px;
  cursor: pointer;
}
/* Title */
#share-modal-content div:first-child {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}
/* Close button */
#share-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  cursor: pointer;
  font-size: 20px; /* 🔥 easier tap */
}
/* URL input */
#share-modal-content input {
  width: 100%;
  padding: 10px;
  font-size: 14px; /* 🔥 readable */
  border-radius: 6px;
  border: none;
  margin-bottom: 12px;
}
@media (max-width: 400px) {
  #share-modal-content {
    font-size: 16px;
  }

  #share-modal-content input,
  #share-modal-content button {
    font-size: 15px;
  }
}
/* Buttons */
#share-modal-content button {
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  border-radius: 8px;
  background: #2a6cff;
  color: #fff;
  border: none;
  font-size: 14px; /* 🔥 bigger */
}
.help-link {
  margin-left: 6px;
  opacity: 0.8;
  cursor: pointer;
  text-decoration: underline;
  font-size: 13px;
}
.help-section {
  margin-bottom: 12px;
}

.help-section h3 {
  font-size: 15px;
  margin-bottom: 4px;
}
.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
.help-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
}

.help-step.highlight {
  position: relative;
}

.help-step.highlight .help-pill {
  box-shadow: 0 0 0 2px rgba(67,181,86,0.6);
  animation: pillPulse 1.5s infinite;
}

@keyframes pillPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.help-pill {
  min-width: 34px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;

  background: rgba(20, 20, 20, 0.95);
  color: #fff;

  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.help-pill.bg {
  background: #43b556;
  color: #111;
}

.help-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.help-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.help-sub {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 2px;
}

@keyframes helpPulse {
  0% { transform: scale(1); opacity: 0.86; }
  50% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); opacity: 0.86; }
}
.help-modal-content {
  background: #111;
  color: #fff;
  padding: 18px;
  border-radius: 12px;
  width: 340px;
  max-width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  font-size: 15px;
}

.help-modal-content h2 {
  font-size: 18px;
  margin-bottom: 12px;
}
.help-section p {
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.4;
}
.help-link:hover {
  opacity: 1;
}
.help-upload-link {
  margin-top: 10px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
}
#help-btn {
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 13px;
}

#help-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
.help-upload-link:hover {
  background: rgba(255, 255, 255, 0.15);
}
.mode-btn.highlight {
  box-shadow: 0 0 0 2px rgba(0, 255, 0, 0.6);
  transition: box-shadow 0.2s ease;
}
.help-tip {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 14px;
  opacity: 0.9;
}
.highlight-bg {
  animation: pulseBG 1.5s infinite;
}

.highlight-p1 {
  animation: pulseP1 1.5s infinite;
}

@keyframes pulseBG {
  0% { background: rgba(58,166,87,0.2); }
  50% { background: rgba(58,166,87,0.5); }
  100% { background: rgba(58,166,87,0.2); }
}

@keyframes pulseP1 {
  0% { background: rgba(255,255,255,0.05); }
  50% { background: rgba(255,255,255,0.2); }
  100% { background: rgba(255,255,255,0.05); }
}
.upload-inner {
  font-size: 13px;
  text-align: center;
  line-height: 1.3;
}

.upload-sub {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 3px;
}
.special-tile {
  border: 1px dashed rgba(255, 255, 255, 0.3);
}
#lab-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 99999;
}

#lab-toast.show {
  opacity: 1;
}
.panel-strip,
.panel-strip * {
  cursor: grab;
}
.panel-strip.dragging,
.panel-strip.dragging * {
  cursor: grabbing;
}
.pattern-picker .promo-card-slider {
  flex: 0 0 70px; /* 🔥 same as pattern-card */
  max-width: 70px;
  min-width: 70px;

  width: 70px !important;
}

.promo-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 9px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 2px 4px;
  border-radius: 3px;
}
/* Image */
.promo-card-slider img {
  width: 100%;
  object-fit: cover; /* 🔥 fills tile cleanly */
  display: block;
  border-radius: 8px;
}
.pattern-picker .promo-card {
  cursor: pointer;
}
.pattern-picker .promo-card-slider .promo-title {
  font-size: 10px;
}

.pattern-picker .promo-card-slider .promo-label {
  font-size: 8px;
}
.pattern-picker .promo-image {
  position: absolute;
  top: 0;
  left: 0;

  width: 100%;

  object-fit: cover;
  display: block;
  z-index: 1;
}

.pattern-picker .promo-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
}
.pattern-picker .promo-card-slider .promo-cta {
  font-size: 9px;
}
/* Inner wrapper 
.promo-card-slider .promo-tile-inner {
  width: 95%;
}*/
.promo-card-slider.promo-tier-2,
.promo-card-slider.promo-tier-3 {
  grid-column: span 1 !important;
}
.promo-card-slider {
  width: 75px !important;
  min-width: 75px;
  max-width: 75px;

  height: 140px; /* 🔥 force consistent height */
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}
/* Overlay */
.promo-card-slider .promo-overlay {
  padding: 6px;
}

/* Text scaling */
.promo-card-slider .promo-label {
  font-size: 9px;
}

.promo-card-slider .promo-title {
  font-size: 11px;
  line-height: 1.1;
}

.promo-card-slider .promo-cta {
  font-size: 10px;
  margin-top: 2px;
}
.has-promo {
  outline: 2px solid gold;
}
.promo-card {
  position: relative;
  overflow: hidden;
  display: flex;
}
.promo-tier-3 {
  grid-column: span 2;
  min-height: 140px;
}
.promo-tier-2 {
  grid-column: span 2;
  min-height: 110px;
}
.promo-tier-3 img {
  height: 100%;
  object-fit: cover;
}
.promo-tier-1 {
  grid-column: span 1;
  min-height: 85px;
  opacity: 0.95;
}
@media (min-width: 900px) {
  .promo-tier-3 {
    grid-column: span 2;
  }

  .promo-tier-2 {
    grid-column: span 2;
  }

  .promo-tier-1 {
    grid-column: span 1;
  }
}
.promo-card:active {
  transform: scale(0.97);
}
#pattern-browser-results .pattern-card {
  min-width: 0;
}
.pattern-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
}
@media (min-width: 900px) {
  .pattern-grid {
    grid-template-columns: repeat(auto-fill, minmax(105px, 1fr));
    max-width: 600px;
    margin: 0 auto;
  }
}
.promo-cta {
  font-size: 11px;
  color: #4caf50;
  margin-top: 4px;
  font-weight: 500;
}
.pattern-grid .pattern-card {
  padding: 0;
  overflow: hidden;
  border-radius: 10px;
  position: relative;
  aspect-ratio: 2 / 3;
}

.pattern-grid .pattern-card img {
  width: 100%;
  height: auto;
  padding: 4px;
}
.pattern-card.featured {
  grid-column: span 2;
}
.pattern-tile-inner {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%; /* 🔥 THIS IS THE FIX */
}

/* 🧠 Brand logo */
.pattern-logo {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: 55%; /* 🔥 smaller */
  max-width: 90%;

  height: auto;
  z-index: 2;
  pointer-events: none;

  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}
.pattern-tile-inner > img:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.promo-card-slider .pattern-logo {
  display: none !important;
}

.promo-card-slider .pattern-overlay {
  display: none !important;
}

.promo-card-slider .pattern-title,
.promo-card-slider .pattern-brand {
  display: none !important;
}
.promo-logo-tile {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 10px;

  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.promo-logo-tile .pattern-tile-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.promo-logo-tile .pattern-tile-inner img {
  width: auto !important;
  height: auto !important;
  max-width: 80%;
  max-height: 80%;
  object-fit: contain !important;
}
.promo-logo-tile img {
  width: 80%;
  height: auto;
  max-height: 80%;
  object-fit: contain;
  display: block;
}
.pattern-title,
.pattern-brand {
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
/* 🧠 Text overlay */
.pattern-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.9),
    rgba(0, 0, 0, 0.2),
    transparent
  );
  z-index: 3;
}
.pattern-tier-header {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 600;
  color: #aaa;
  padding: 6px 4px;
  margin-top: 10px;
}
/* tier color cues */
.pattern-tier-header:contains("Sponsored") {
  color: gold;
}

.pattern-tier-header:contains("Featured") {
  color: #4caf50;
}

.pattern-tier-header:contains("Affiliate") {
  color: #2196f3;
}
.pattern-title {
  font-size: 12px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.promo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
}

.promo-label {
  font-size: 10px;
  color: #aaa;
}

.promo-title {
  font-size: 13px;
  font-weight: bold;
  color: #fff;
}
.featured-pattern {
  grid-column: span 2;
}
.ad-200x100,
#promo-200x100,
.promo-banner {
  display: none !important;
}
#lab-promo {
  display: none !important;
}
.panel-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: transparent;
  border-radius: 8px;
  padding: 8px;
}

.panel-controls label {
  font-size: 12px;
  opacity: 0.8;
}
.panel-actions.hidden {
  display: none;
}
.hidden {
  display: none;
}
.panel-controls input[type="range"] {
  width: 100%;
}
#pattern-browser-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;

  background: #0f0f0f;
  z-index: 99999;

  display: none;
  flex-direction: column;
}

#pattern-browser-modal.active {
  display: flex;
}

#lab-help {
  position: absolute;
  bottom: calc(45dvh + 20px);
  left: 50%;
  transform: translateX(-50%);

  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  color: #fff;
  padding: 10px 12px;
  border-radius: 12px;

  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;

  min-width: 220px;
  max-width: 280px;

  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);

  pointer-events: none;
}
#lab-help {
  animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
/* 🥇 Sponsored */
.pattern-thumb.tier-1 {
  border-color: gold;
}

/* ⭐ Featured */
.pattern-thumb.tier-2 {
  border-color: #4caf50;
}

/* 🔗 Affiliate */
.pattern-thumb.tier-3 {
  border-color: #2196f3;
}

/* Default */
.pattern-thumb.tier-4 {
  opacity: 0.9;
}
.pattern-label {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s ease;
  display: inline-block;
}

.pattern-label:hover {
  background: #222;
}

.pattern-divider {
  margin: 0 6px;
  color: #666;
}
.pattern-picker {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  border-top: 1px solid #222;
  padding-top: 8px;
}
.pattern-picker {
  scroll-snap-type: x mandatory;
}

.pattern-card {
  scroll-snap-align: start;
}
.pattern-card {
  background: #111;
  border-radius: 10px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  min-width: 70px;
  flex-shrink: 0;
  grid-column: span 1;
}

.pattern-card > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pattern-card.active {
  outline: 2px solid #4caf50;
}
.pattern-card:active {
  transform: scale(0.97);
}
.pattern-brand {
  font-size: 10px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  color: #ccc;
}
.pattern-grid .pattern-logo {
  width: 48px;
  height: auto;
  max-width: 50%;
}
.pattern-grid .pattern-tile-inner img:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pattern-name {
  font-size: 11px;
  line-height: 1.1;
  font-weight: bold;
  margin-bottom: 4px;
}
#lab-stage {
  isolation: isolate;
}
.more-card {
  background: #1c1c1c;
  border: 1px dashed #4caf50;
  color: #4caf50;
}
#selected-patterns {
  position: absolute;
  top: 65px; /* just below toolbar */
  left: 10px;
  right: 10px;

  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);

  padding: 6px 10px;
  border-radius: 8px;

  font-size: 11px;
  color: #ddd;

  z-index: 20;
  text-align: center;
}
#selected-patterns a {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #eee;
  display: inline-block;
  margin: 0 4px;
}

#selected-patterns a.p1 {
  border: 1px solid rgba(255, 107, 107, 0.4);
}

#selected-patterns a.p2 {
  border: 1px solid rgba(77, 171, 247, 0.4);
}
#selected-patterns a:hover {
  opacity: 0.8;
  text-decoration: underline;
}

#selected-patterns a:hover {
  text-decoration: underline;
}
#info-bar {
  position: absolute;
  top: 0; /* JS controls this */
  left: 10px;
  right: 10px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  background: transparent;
  pointer-events: none;

  min-height: 30px;
  z-index: 25;
}

.info-left {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.info-right {
  display: flex;
  justify-content: flex-end;
}

.info-label {
  font-size: 11px;
  opacity: 0.6;
  display: flex;
  align-items: center;
}

.info-btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;

  pointer-events: auto;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;

  border: 1px solid rgba(255, 255, 255, 0.2);

  backdrop-filter: blur(4px);
  cursor: pointer;
}

.info-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.info-btn.p1 {
  border-color: rgba(255, 82, 82, 0.5);
}
.info-btn.p2 {
  border-color: rgba(33, 150, 243, 0.5);
}
.info-btn.bg {
  border-color: rgba(255, 255, 255, 0.3);
}
.info-btn.promo {
  border-color: rgba(76, 175, 80, 0.6);
  font-weight: 600;
}
.bg-modal-sub {
  font-size: 12px;
  opacity: 0.6;
  margin-bottom: 10px;
}

.bg-modal-details div {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.bg-modal-details span {
  opacity: 0.6;
  color: #888;
  font-size: 12px;
}
.bg-modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
}

.bg-modal-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.bg-modal-details span {
  display: inline-block;
  min-width: 85px;
  opacity: 0.6;
}
#help-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
}

#help-modal.hidden {
  display: none;
}

.help-content {
  max-width: 400px;
  margin: 80px auto;
  background: #111;
  padding: 20px;
  border-radius: 10px;
  color: #fff;
}

@media (min-width: 769px) {
  #bg-layer {
    background-color: #000;
  }
}
#sale-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#sale-modal-content {
  background: #121212; /* 🔥 match lab */
  color: #fff;
  padding: 15px;
  border-radius: 10px;
  width: 280px;
  max-width: 92%;
  text-align: center;
  position: relative;
}

#sale-modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  cursor: pointer;
  font-size: 18px;
}

#sale-modal-body {
  margin-bottom: 10px;
  font-size: 14px;
}

#sale-modal-link {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 12px;
  background: #2a6cff;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
}
/* 🔥 FORCE MODAL TILE BEHAVIOR */
.pattern-grid .pattern-tile-inner img:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pattern-tile-inner img:first-child {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}
/* 🔥 prevent old strip styles from leaking in */
.pattern-grid .pattern-card {
  min-width: 0 !important;
}
/* =========================
   MY BACKGROUNDS SECTION
========================= */

.my-bg-section {
  background: rgba(255, 255, 255, 0.02);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid #333;
}

.my-bg-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.my-bg-header h3 {
  margin: 0;
  font-size: 16px;
  color: #fff;
}

.my-bg-sub {
  font-size: 11px;
  color: #aaa;
  margin-top: 2px;
}

.my-bg-grid {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

/* Make My BGs slightly more prominent */
.my-bg-grid .bg-thumb {
  min-width: 110px;
  border: 2px solid #444;
}

.my-bg-grid .bg-thumb:hover {
  border-color: #888;
}
.my-bg-grid .bg-thumb.active {
  border-color: #4caf50;
}
