:root {
  --bg: #0d0d0f;
  --card: #17171b;
  --card-2: #1f1f25;
  --line: #2a2a31;
  --text: #f2f0eb;
  --muted: #9a978f;
  --gold: #c9a45c;
  --gold-2: #e6c98a;
  --red: #e5566b;
  --green: #4fbf7f;
  --radius: 14px;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select {
  width: 100%; background: var(--bg); color: var(--text); font: inherit;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.loading, .empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.pre { white-space: pre-wrap; line-height: 1.5; }

/* En-tête */
.top {
  position: sticky; top: 0; z-index: 5; padding: 14px 16px 12px;
  background: rgba(13, 13, 15, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
h1 { margin: 0; font-size: 19px; letter-spacing: .2em; text-align: center; font-weight: 600; }
h1 span { color: var(--gold); }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 18px 0 10px; color: var(--gold-2); }
.page { padding: 14px; }

/* Barre d'onglets */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgba(17, 17, 20, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
}
.tabbar button {
  background: none; border: none; color: var(--muted); font-size: 10.5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tabbar .ic { font-size: 20px; position: relative; filter: grayscale(1) opacity(.7); }
.tabbar button.active { color: var(--gold); }
.tabbar button.active .ic { filter: none; }
.badge {
  position: absolute; top: -4px; right: -10px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--gold); color: var(--bg); font-size: 10px; font-weight: 700;
  display: grid; place-items: center; font-style: normal;
}

/* Boutons */
.btn {
  display: block; width: 100%; border: none; border-radius: 12px; padding: 13px;
  background: var(--gold); color: var(--bg); font-weight: 700; letter-spacing: .02em;
}
.btn:disabled { opacity: .45; }
.btn.ghost { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn.sm { display: inline-block; width: auto; padding: 8px 12px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* Filtres */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; font-size: 13.5px;
}
.chip.active { border-color: var(--gold); color: var(--bg); background: var(--gold); font-weight: 600; }
.sorts { display: flex; gap: 8px; margin-top: 10px; }
.sorts .chip { flex: 1; text-align: center; }

/* Grille produits */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; text-align: left; padding: 0;
}
.thumb {
  aspect-ratio: 1; width: 100%; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #24242a 0%, #111114 100%);
  display: grid; place-items: center; color: var(--gold); font-size: 34px; font-weight: 600;
}
.thumb img, .thumb video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb .tag {
  position: absolute; top: 8px; left: 8px; background: var(--gold); color: var(--bg);
  font-size: 10px; font-weight: 700; padding: 3px 7px; border-radius: 6px; letter-spacing: .05em;
}
.card .body { padding: 10px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card .name { font-size: 14px; font-weight: 600; }
.card .cat { font-size: 11.5px; color: var(--muted); }
.card .foot { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 6px; }
.price { color: var(--gold-2); font-weight: 600; }
.likes { font-size: 12.5px; color: var(--muted); }
.likes.on { color: var(--red); }

/* Panneau du bas (fiche produit) */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 92vh; overflow-y: auto;
  background: var(--card); border-top: 1px solid var(--gold); border-radius: 18px 18px 0 0;
  padding: 0 0 calc(20px + env(safe-area-inset-bottom));
}
.sheet-close {
  position: sticky; top: 0; float: right; margin: 10px; z-index: 2; width: 34px; height: 34px;
  border-radius: 50%; border: none; background: rgba(0, 0, 0, .55); color: #fff; font-size: 16px;
}
.gallery { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.gallery::-webkit-scrollbar { display: none; }
.gallery > * { flex: none; width: 100%; aspect-ratio: 1; object-fit: cover; scroll-snap-align: start; background: #000; }
.gallery .placeholder {
  display: grid; place-items: center; font-size: 60px; color: var(--gold);
  background: linear-gradient(135deg, #24242a 0%, #111114 100%);
}
.dots { text-align: center; color: var(--muted); font-size: 12px; margin-top: 6px; }
.sheet .content { padding: 14px 16px; }
.title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.like-btn {
  flex: none; border: 1px solid var(--line); background: var(--card-2); border-radius: 999px;
  padding: 7px 12px; font-size: 14px;
}
.like-btn.on { border-color: var(--red); color: var(--red); }
.formats { display: flex; flex-wrap: wrap; gap: 8px; }
.format {
  border: 1px solid var(--line); background: var(--card-2); border-radius: 12px; padding: 9px 12px;
  display: flex; flex-direction: column; align-items: flex-start; min-width: 90px;
}
.format small { color: var(--gold-2); font-weight: 600; margin-top: 2px; }
.format.active { border-color: var(--gold); background: rgba(201, 164, 92, .12); }
.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 12px; }
.stepper button { width: 38px; height: 38px; border: none; background: none; color: var(--gold); font-size: 20px; }
.stepper span { min-width: 26px; text-align: center; font-weight: 600; }

/* Panier */
.line {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.line .thumb { border-radius: 10px; font-size: 20px; }
.line .stepper button { width: 32px; height: 32px; font-size: 17px; }
.totals { display: flex; justify-content: space-between; font-size: 17px; margin: 16px 0; }
.totals strong { color: var(--gold-2); }

/* Avis */
.rating-box { display: flex; gap: 18px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.rating-box .big { font-size: 40px; font-weight: 700; color: var(--gold-2); line-height: 1; }
.bars { flex: 1; }
.bar { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.bar i { flex: 1; height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i b { display: block; height: 100%; background: var(--gold); }
.stars { color: var(--gold); letter-spacing: 2px; }
.stars .off { color: var(--line); }
.star-picker { display: flex; gap: 6px; font-size: 32px; }
.star-picker button { background: none; border: none; padding: 0; color: var(--line); }
.star-picker button.on { color: var(--gold); }
.review { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.review .head { display: flex; justify-content: space-between; margin-bottom: 6px; }

/* Infos / contact / profil */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.profile-head { display: flex; gap: 14px; align-items: center; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 24px; font-weight: 700;
  background: linear-gradient(135deg, var(--gold) 0%, #8b6b2e 100%); color: var(--bg);
}
.coins { display: flex; align-items: center; justify-content: space-between; }
.coins .amount { font-size: 28px; font-weight: 700; color: var(--gold-2); }
.order { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.order .head { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 6px; }
.status { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: var(--card-2); color: var(--gold-2); font-weight: 600; }
.status.ok { color: var(--green); }
.status.bad { color: var(--red); }

/* Admin */
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.admin-item {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.admin-item .meta { flex: 1; min-width: 0; }
.admin-item .meta div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.format-row { display: grid; grid-template-columns: 1fr 90px 38px; gap: 8px; margin-bottom: 8px; }
.format-row button { border: 1px solid var(--line); background: none; border-radius: 10px; color: var(--red); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.media-grid .thumb { border-radius: 10px; font-size: 14px; }
.media-grid .del {
  position: absolute; top: 4px; right: 4px; z-index: 2; width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(0, 0, 0, .7); color: #fff; font-size: 13px;
}
.check { display: flex; gap: 10px; align-items: center; color: var(--text); font-size: 14px; }
.check input { width: auto; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 40; max-width: 90vw;
  background: var(--gold); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; text-align: center;
}
.toast.error { background: var(--red); color: #fff; }
.order-btns { display: flex; flex-direction: column; gap: 4px; }
.order-btns button {
  width: 30px; height: 24px; border: 1px solid var(--line); background: var(--card-2);
  border-radius: 6px; color: var(--gold); font-size: 10px; padding: 0;
}
.order-btns button:disabled { opacity: .25; }

/* Menus déroulants */
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px; background-repeat: no-repeat;
}

/* Livraison, bons d'achat, fidélité */
.row-between { display: flex; justify-content: space-between; margin: 6px 0; font-size: 14px; }
.totals-box { margin-top: 14px; }
.min-order { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius); background: rgba(201, 164, 92, .1); border: 1px solid rgba(201, 164, 92, .35); color: var(--gold-2); font-size: 14px; }
.voucher {
  margin-top: 14px; padding: 12px; border: 1px dashed var(--gold); border-radius: 12px;
  background: rgba(201, 164, 92, .08); align-items: flex-start;
}
.voucher.off { border-color: var(--line); background: none; color: var(--muted); }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 12px 0 6px; }
.progress b { display: block; height: 100%; background: linear-gradient(90deg, #8b6b2e, var(--gold-2)); }
.voucher-list { margin-top: 12px; display: grid; gap: 8px; }
.voucher-list div { border: 1px dashed var(--gold); border-radius: 10px; padding: 10px; font-size: 14px; }
.avatar { overflow: hidden; flex: none; border: 2px solid var(--gold); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Écran de chargement ---------- */
#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(ellipse at 50% 38%, #1c1810 0%, var(--bg) 62%);
  transition: opacity .5s ease, visibility .5s;
}
#splash.done { opacity: 0; visibility: hidden; }
.splash-logo { position: relative; width: 190px; height: 190px; }
.splash-halo {
  position: absolute; inset: -26px; border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 201, 138, .38) 0%, rgba(201, 164, 92, .12) 45%, transparent 70%);
  animation: halo 2s ease-in-out infinite;
}
.splash-disc {
  position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(201, 164, 92, .55), 0 12px 40px rgba(0, 0, 0, .7);
  animation: logo-in .9s cubic-bezier(.2, .8, .2, 1.15) both;
}
.splash-disc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.splash-sheen {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 236, 190, .55) 48%, rgba(255, 255, 255, .8) 50%, rgba(255, 236, 190, .55) 52%, transparent 65%);
  transform: translateX(-120%);
  animation: sheen 1.6s ease-in-out .5s infinite;
}
.splash-title { display: flex; gap: 6px; font-size: 18px; font-weight: 600; color: var(--gold-2); letter-spacing: .08em; }
.splash-title b { width: 10px; }
.splash-title span { opacity: 0; transform: translateY(8px); animation: letter .5s ease forwards; }
.splash-title span:nth-child(1) { animation-delay: .35s; }  .splash-title span:nth-child(2) { animation-delay: .42s; }
.splash-title span:nth-child(3) { animation-delay: .49s; }  .splash-title span:nth-child(4) { animation-delay: .56s; }
.splash-title span:nth-child(5) { animation-delay: .63s; }  .splash-title span:nth-child(7) { animation-delay: .77s; }
.splash-title span:nth-child(8) { animation-delay: .84s; }  .splash-title span:nth-child(9) { animation-delay: .91s; }
.splash-title span:nth-child(10) { animation-delay: .98s; } .splash-title span:nth-child(11) { animation-delay: 1.05s; }
.splash-title span:nth-child(12) { animation-delay: 1.12s; }
.splash-bar {
  width: min(240px, 70vw); height: 4px; border-radius: 2px; overflow: hidden;
  background: rgba(201, 164, 92, .15); box-shadow: inset 0 0 0 1px rgba(201, 164, 92, .25);
}
.splash-bar b {
  display: block; height: 100%; width: 0; border-radius: 2px;
  background: linear-gradient(90deg, #8b6b2e, var(--gold), #fff1c9, var(--gold));
  background-size: 200% 100%; animation: bar-shine 1.2s linear infinite;
  box-shadow: 0 0 10px rgba(230, 201, 138, .7);
}
.splash-meta {
  width: min(240px, 70vw); display: flex; justify-content: space-between;
  font-size: 11.5px; color: var(--muted); margin-top: -12px; font-variant-numeric: tabular-nums;
}
#splash-pct { color: var(--gold-2); }

@keyframes logo-in { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: scale(1); } }
@keyframes halo { 0%, 100% { opacity: .55; transform: scale(.96); } 50% { opacity: 1; transform: scale(1.05); } }
@keyframes sheen { 0% { transform: translateX(-120%); } 60%, 100% { transform: translateX(120%); } }
@keyframes letter { to { opacity: 1; transform: none; } }
@keyframes bar-shine { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  .splash-halo, .splash-sheen, .splash-bar b { animation: none; }
  .splash-disc, .splash-title span { animation-duration: .01s; animation-delay: 0s; }
}
.order-btn { display: block; width: 100%; text-align: left; color: var(--text); }
.order-btn:active { border-color: var(--gold); }
