:root {
  --bg-deep: #150d1d;
  --bg-elevated: #201530;
  --bg-elevated-2: #2a1d3f;
  --accent-pink: #ff5c8a;
  --accent-purple: #a86bff;
  --accent-gradient: linear-gradient(135deg, #ff5c8a 0%, #a86bff 100%);
  --gold: #ffd166;
  --text-primary: #fbf7ff;
  --text-secondary: #b3a3c4;
  --border: rgba(255, 255, 255, 0.08);
  --success: #4be3b0;
  --danger: #ff6b6b;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.4);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/*
  Les regles de composants ci-dessous (.product-grid, .empty-state, .category-chips, ...)
  fixent chacune leur propre "display". Une regle auteur normale l'emporte toujours sur
  la regle "[hidden] { display: none }" de l'agent utilisateur, meme a specificite egale,
  donc sans ceci l'attribut hidden pose par le JS n'aurait aucun effet visuel.
*/
[hidden] {
  display: none !important;
}

html,
body {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
}

/*
  Fond personnalise (photo envoyee via /setbackground) : l'image est posee sur le
  body, un voile sombre par dessus garde le contraste texte/cartes identique quelle
  que soit l'image, et les blobs decoratifs par defaut sont masques pour ne pas se
  superposer a la photo.
*/
body.has-custom-bg {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

body.has-custom-bg::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: rgba(21, 13, 29, 0.82);
}

body.has-custom-bg .bg-decor {
  display: none;
}

h1,
h2,
.brand-logo {
  font-family: "Baloo 2", "Inter", sans-serif;
}

button,
select,
input {
  font-family: inherit;
}

/* ---------- ecran de chargement (splash) ---------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 24px;
  background: radial-gradient(circle at 50% 38%, var(--bg-elevated) 0%, var(--bg-deep) 70%);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash.hide {
  opacity: 0;
  visibility: hidden;
}

.splash-logo-wrap {
  width: 190px;
  height: 190px;
  border-radius: 50%;
  padding: 5px;
  background: var(--accent-gradient);
  box-shadow: 0 0 60px rgba(168, 107, 255, 0.55);
  animation: splash-pulse 1.8s ease-in-out infinite;
}

.splash-logo {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--bg-elevated-2) center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 72px;
}

.splash-logo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

@keyframes splash-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.splash-name {
  margin: 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-primary);
}

.splash-bar {
  width: min(80%, 320px);
  height: 8px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
}

.splash-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--accent-gradient);
  transition: width 0.2s ease;
}

.splash-pct {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
}

.bg-decor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.35;
}

.blob-1 {
  width: 260px;
  height: 260px;
  background: var(--accent-pink);
  top: -80px;
  left: -60px;
}

.blob-2 {
  width: 220px;
  height: 220px;
  background: var(--accent-purple);
  top: 120px;
  right: -70px;
}

.blob-3 {
  width: 240px;
  height: 240px;
  background: var(--gold);
  bottom: 40px;
  left: 30%;
  opacity: 0.16;
}

#app {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px calc(110px + var(--safe-bottom));
  min-width: 0;
}

/* ---------- header ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 6px 16px;
  margin: -14px -6px 6px;
  background: linear-gradient(var(--bg-deep) 60%, transparent);
  backdrop-filter: blur(6px);
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 14px;
  background: var(--accent-gradient);
  box-shadow: 0 6px 16px rgba(168, 107, 255, 0.35);
  overflow: hidden;
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-text {
  min-width: 0;
}

.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-tag {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cart-btn {
  flex: none;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.cart-btn:active {
  transform: scale(0.92);
}

.cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cart-count.pop {
  transform: scale(1.35);
}

.topbar-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
}

/* ---------- vignettes de stock ---------- */

.stock-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 3;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 5px 8px;
  border-radius: 999px;
}

.stock-badge.out,
.stock-badge.soon {
  top: 50%;
  transform: translateY(-50%);
  background: rgba(20, 8, 12, 0.82);
}

.stock-badge.out {
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.5);
}

.stock-badge.soon {
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.stock-badge.low {
  background: var(--gold);
  color: #3a2a00;
}

/* Badges marketing (New, Best Seller) : compacts en haut a gauche, pas de grisage */
.badge.marketing-new {
  background: var(--accent-pink);
  color: #fff;
}

.badge.marketing-bestseller {
  background: var(--gold);
  color: #3a2a00;
}

.product-card.out-of-stock {
  cursor: default;
}

.product-card.out-of-stock:active {
  transform: none;
}

.product-card.out-of-stock .thumb-wrap img,
.product-card.out-of-stock .thumb-wrap video {
  filter: grayscale(1) brightness(0.55);
}

.detail-stock {
  margin: 0 0 12px;
  font-size: 13.5px;
  font-weight: 600;
}

.detail-stock.low {
  color: var(--gold);
}

.review-product {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-purple);
}

/* ---------- filters ---------- */

.category-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0 10px;
  min-width: 0;
}

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

.chip {
  flex: none;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.chip:active {
  transform: scale(0.95);
}

.chip.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

.sort-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
  font-size: 12px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 30px 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  max-width: 100%;
}

/* ---------- views ---------- */

.view {
  animation: fade-in 0.25s ease;
}

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

.section-title {
  font-size: 20px;
  margin: 4px 0 14px;
}

/* ---------- product grid ---------- */

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

.product-card {
  min-width: 0;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease;
  animation: fade-in 0.35s ease backwards;
}

.product-card:active {
  transform: scale(0.97);
}

.thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-elevated-2);
}

.thumb-wrap img,
.thumb-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-wrap::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 40%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.45), transparent);
}

.badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  display: inline-block;
  background: var(--gold);
  color: #3a2a00;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.02em;
  padding: 3px 8px;
  border-radius: 999px;
}

.badge.promo {
  left: auto;
  right: 8px;
  background: var(--success);
  color: #08332a;
}

.card-info {
  padding: 10px 12px 12px;
  min-width: 0;
}

.card-name {
  font-size: 13.5px;
  font-weight: 600;
  margin: 0 0 6px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.price-old {
  text-decoration: line-through;
  color: var(--text-secondary);
  font-size: 12px;
}

.price-now {
  color: var(--success);
  font-weight: 700;
  font-size: 14px;
}

.variant-count {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

/* ---------- skeletons ---------- */

.skeleton-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.skeleton-thumb {
  aspect-ratio: 1 / 1;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-elevated-2) 37%, var(--bg-elevated) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.skeleton-line {
  height: 10px;
  margin: 10px 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-elevated-2) 37%, var(--bg-elevated) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.skeleton-line.short {
  width: 50%;
}

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

/* ---------- empty state ---------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 60px 20px;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 34px;
}

/* ---------- product detail ---------- */

.detail-image-wrap {
  position: relative;
  aspect-ratio: 5 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow-card);
  background: var(--bg-elevated-2);
}

.detail-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-back {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(21, 13, 29, 0.55);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.detail-name {
  font-size: 21px;
  margin: 0 0 6px;
}

.detail-desc {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 18px;
  line-height: 1.5;
}

/* ---------- avis clients ---------- */

.reviews-title {
  font-size: 17px;
  margin: 24px 0 12px;
  color: var(--text-primary);
}

.review {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
}

.review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.review-author {
  font-weight: 700;
  font-size: 14px;
}

.review-stars {
  color: var(--gold);
  font-size: 14px;
  letter-spacing: 1px;
  white-space: nowrap;
}

.review-text {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 8px;
}

.review-media {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  display: block;
  background: var(--bg-elevated-2);
}

.variant-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  min-width: 0;
}

.variant-info {
  min-width: 0;
}

.variant-label {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 3px;
}

.variant-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-elevated-2);
  border-radius: 999px;
  padding: 4px;
}

.qty-control button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.qty-control button:active {
  background: rgba(255, 255, 255, 0.08);
}

.qty-value {
  min-width: 22px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.add-btn {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.15s ease;
  white-space: nowrap;
}

.add-btn:active {
  transform: scale(0.94);
}

/* ---------- cart ---------- */

.back-btn {
  background: none;
  border: none;
  color: var(--accent-pink);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 0 12px;
  cursor: pointer;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 10px;
  min-width: 0;
}

.cart-item .thumb {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--bg-elevated-2);
}

.cart-item .info {
  flex: 1;
  min-width: 0;
}

.cart-item .remove {
  flex: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 6px;
}

.empty-cart-msg {
  text-align: center;
  color: var(--text-secondary);
  padding: 30px 10px;
}

/* ---------- platform choice ---------- */

.platform-hint {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 16px;
}

.platform-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.platform-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, background 0.15s ease;
}

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

.platform-icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border-radius: 12px;
  background: var(--accent-gradient);
}

.platform-icon.icon-telegram {
  background: linear-gradient(135deg, #2aabee 0%, #229ed9 100%);
}

.platform-icon.icon-whatsapp {
  background: linear-gradient(135deg, #25d366 0%, #128c3e 100%);
}

.platform-info {
  min-width: 0;
}

.platform-name {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 2px;
}

.platform-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin: 0;
}

.delivery-mode {
  display: flex;
  gap: 8px;
  margin: 18px 0 10px;
}

.mode-btn {
  flex: 1;
  min-width: 0;
  padding: 11px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.mode-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
}

.address-wrap {
  position: relative;
  margin-bottom: 10px;
}

.address-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  margin-bottom: 0;
  font-size: 14px;
  min-width: 0;
}

.address-input::placeholder {
  color: var(--text-secondary);
}

.address-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.address-suggestion {
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.address-suggestion:last-child {
  border-bottom: none;
}

.address-suggestion:active {
  background: var(--bg-elevated);
}

.address-map {
  margin-top: 10px;
  height: 160px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.promo-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.promo-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.promo-row input::placeholder {
  color: var(--text-secondary);
}

.promo-row button {
  flex: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-elevated-2);
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.promo-msg {
  font-size: 13px;
  min-height: 18px;
  margin: 0 0 8px;
}

/* ---------- fidelite ---------- */

.icon-btn img {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  object-fit: cover;
}

.loyalty-map {
  position: relative;
  width: 100%;
  height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 14px;
  background: radial-gradient(circle at 50% 30%, #3a1f5c 0%, #1a1030 75%);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}

.loyalty-map canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
}

.loyalty-map canvas:active {
  cursor: grabbing;
}

.loyalty-prizes {
  margin-bottom: 16px;
}

.loyalty-prizes-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
}

.loyalty-prize-chip {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gold);
}

.loyalty-code-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  min-width: 0;
}

.loyalty-code-row input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.loyalty-code-row input::placeholder {
  color: var(--text-secondary);
}

.loyalty-code-row button {
  flex: none;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.loyalty-code-msg {
  font-size: 13px;
  min-height: 18px;
  margin: 0 0 18px;
}

.loyalty-hint {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 0 0 18px;
}

.loyalty-case {
  margin: 8px 0 6px;
}

.loyalty-cloud-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 140px;
  border: none;
  background: transparent;
  cursor: pointer;
}

.loyalty-cloud-half {
  position: absolute;
  top: 42%;
  left: 50%;
  font-size: 60px;
  line-height: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s ease;
}

.loyalty-cloud-btn.opening .loyalty-cloud-left {
  transform: translate(-170%, -70%) rotate(-18deg);
  opacity: 0;
}

.loyalty-cloud-btn.opening .loyalty-cloud-right {
  transform: translate(70%, -70%) rotate(18deg);
  opacity: 0;
}

.loyalty-cloud-label {
  position: absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-secondary);
  transition: opacity 0.3s ease;
}

.loyalty-cloud-btn.opening .loyalty-cloud-label {
  opacity: 0;
}

.loyalty-strip-wrap {
  position: relative;
  height: 108px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  animation: fade-in 0.3s ease;
}

.loyalty-strip-pointer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--gold);
  z-index: 3;
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.8);
}

.loyalty-strip-pointer::before,
.loyalty-strip-pointer::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
}

.loyalty-strip-pointer::before {
  top: 0;
  border-top: none;
  border-bottom-color: var(--gold);
}

.loyalty-strip-pointer::after {
  bottom: 0;
  border-bottom: none;
  border-top-color: var(--gold);
}

.loyalty-strip-track {
  display: flex;
  align-items: center;
  height: 100%;
  will-change: transform;
}

.loyalty-strip-card {
  flex: none;
  width: 80px;
  height: 88px;
  margin: 0 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 4px;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.loyalty-strip-card img {
  width: 38px;
  height: 38px;
  object-fit: cover;
  border-radius: 8px;
}

.loyalty-strip-emoji {
  font-size: 26px;
}

.loyalty-strip-label {
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.loyalty-strip-winner {
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.6);
}

/* ---------- popup de lot gagne ---------- */

.loyalty-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 5, 18, 0.72);
  backdrop-filter: blur(4px);
  animation: fade-in 0.25s ease;
}

.loyalty-popup-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 20px 22px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.loyalty-popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated-2);
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
}

.loyalty-popup-img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin: 0 0 16px;
}

.loyalty-popup-text {
  margin: 6px 0 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--text-primary);
  white-space: pre-line;
}

.loyalty-popup-code-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 12px;
  background: var(--bg-elevated-2);
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
}

.loyalty-popup-code {
  flex: 1;
  min-width: 0;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  overflow-wrap: anywhere;
}

.loyalty-popup-copy {
  flex: none;
  padding: 8px 12px;
  border-radius: 999px;
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
}

.totals {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-top: 10px;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 5px 0;
  color: var(--text-secondary);
}

#discount span:last-child,
#discount-row span:last-child {
  color: var(--success);
}

.total-line {
  font-weight: 700;
  font-size: 17px;
  color: var(--text-primary) !important;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px !important;
}

.total-line span {
  color: var(--text-primary);
}

/* ---------- sticky action bar ---------- */

.action-bar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 30;
  max-width: 528px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 10px 10px 18px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.5);
  transform: translateY(0);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.action-bar[hidden] {
  display: flex !important;
  transform: translateY(140%);
  opacity: 0;
  pointer-events: none;
}

.action-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.action-count {
  font-size: 11px;
  color: var(--text-secondary);
}

.action-total {
  font-size: 15px;
  font-weight: 700;
}

.action-btn {
  flex: none;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.15s ease;
}

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

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translate(-50%, -60px);
  z-index: 60;
  background: var(--bg-elevated-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  max-width: 90%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

@media (max-width: 340px) {
  .brand-tag {
    display: none;
  }
}

/* ---------- Améliorations de la charte graphique ---------- */
.topbar {
  background: rgba(10, 5, 18, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.action-bar {
  background: rgba(22, 14, 33, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.product-card {
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  border: 1px solid rgba(255,255,255,0.04);
}

.product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.4);
  border-color: rgba(255,255,255,0.08);
}

.add-btn {
  box-shadow: 0 4px 12px rgba(255, 92, 138, 0.3);
}

.action-btn {
  box-shadow: 0 4px 12px rgba(255, 92, 138, 0.4);
}

/* ---------- Captcha ---------- */
.captcha-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.captcha-screen.hide {
  opacity: 0;
  visibility: hidden;
}

.captcha-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.3);
}

.captcha-badge {
  display: inline-block;
  padding: 6px 12px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.captcha-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
}

.captcha-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0 0 32px;
}

.captcha-slider-wrap {
  position: relative;
  height: 52px;
  background: var(--bg-elevated-2);
  border-radius: 999px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.captcha-slider-track {
  position: absolute;
  inset: 0;
}

.captcha-track-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  pointer-events: none;
}

.captcha-slider-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: rgba(255, 92, 138, 0.15);
  border-radius: 999px 0 0 999px;
}

.captcha-slider-handle {
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 44px;
  background: var(--accent-gradient);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(255, 92, 138, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  cursor: grab;
  margin-left: 4px;
  z-index: 2;
}

.captcha-slider-handle:active {
  cursor: grabbing;
}

.captcha-slider-handle.success {
  background: var(--success);
  box-shadow: 0 4px 12px rgba(76, 217, 100, 0.4);
}

/* ---------- Parrainage ---------- */
.referral-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.referral-icon {
  font-size: 42px;
  margin-bottom: 12px;
  filter: drop-shadow(0 4px 12px rgba(255,209,102,0.3));
}

.referral-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 12px;
}

.referral-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 24px;
}

.referral-stats {
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  min-width: 140px;
}

.stat-number {
  display: block;
  font-size: 32px;
  font-weight: 800;
  color: var(--gold);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.referral-link-wrap {
  display: flex;
  gap: 8px;
  background: var(--bg-elevated-2);
  padding: 6px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

#referral-link-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 13px;
  padding: 0 10px;
  outline: none;
}

#referral-copy-btn {
  flex: none;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

/* ---------- Gain precedent ---------- */
.loyalty-last-win {
  margin-top: -12px;
  margin-bottom: 16px;
  position: relative;
  z-index: 10;
  animation: fade-in 0.4s ease;
}

.last-win-header {
  text-align: center;
  margin-bottom: -10px;
  position: relative;
  z-index: 2;
}

.last-win-badge {
  display: inline-block;
  background: var(--gold);
  color: #3a2a00;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(255,209,102,0.3);
}

.last-win-content {
  background: rgba(255,209,102,0.1);
  border: 1px solid rgba(255,209,102,0.3);
  border-radius: var(--radius-md);
  padding: 18px 14px 14px;
}

.last-win-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.last-win-img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.last-win-emoji {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  background: rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
}

.last-win-info {
  flex: 1;
  min-width: 0;
}

.last-win-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 4px;
}

.last-win-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.last-win-code {
  font-family: monospace;
  font-size: 14px;
  background: rgba(0,0,0,0.3);
  padding: 4px 8px;
  border-radius: 4px;
  color: #fff;
}

.last-win-copy-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}

/* ---------- Notices Zones ---------- */
.delivery-zone-notice {
  margin-top: 10px;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  animation: fade-in 0.3s ease;
}

.delivery-zone-notice.in-zone {
  background: rgba(76, 217, 100, 0.1);
  border: 1px solid rgba(76, 217, 100, 0.3);
  color: var(--success);
}

.delivery-zone-notice.out-zone {
  background: rgba(255, 107, 107, 0.1);
  border: 1px solid rgba(255, 107, 107, 0.3);
  color: var(--danger);
}
