:root {
  --fond: #0b0f1a;
  --fond2: #131a2b;
  --carte: #18223a;
  --bord: #263452;
  --texte: #e8edf7;
  --doux: #93a1bd;
  --accent: #66c0f4;
  --accent2: #a46cff;
  --vert: #5bd38a;
  --jaune: #ffc857;
  --rouge: #ff5d73;
  --rayon: 14px;
  --ombre: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #1d2b52 0%, transparent 60%),
              radial-gradient(900px 500px at 100% 0%, #2b1d52 0%, transparent 55%), var(--fond);
  color: var(--texte);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  -webkit-font-smoothing: antialiased;
}
#fond-flou { position: fixed; inset: 0; z-index: -1; background-size: cover; background-position: center;
  filter: blur(60px) saturate(1.4); opacity: 0; transition: opacity 1s; }
#fond-flou.visible { opacity: .18; }
.cache { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
kbd { background: var(--fond2); border: 1px solid var(--bord); border-radius: 5px; padding: 0 5px; font-size: 12px; }

/* --- boutons --- */
.bouton { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte); cursor: pointer; text-decoration: none;
  transition: transform .12s, background .15s, border-color .15s; white-space: nowrap; }
.bouton:hover { transform: translateY(-1px); border-color: var(--accent); }
.bouton:active { transform: translateY(0) scale(.97); }
.bouton.principal { background: linear-gradient(135deg, #47a3e6, #6f5cff); border-color: transparent; font-weight: 600; }
.bouton.discret { background: transparent; }
.bouton.danger:hover { border-color: var(--rouge); color: var(--rouge); }
.bouton.hasard { background: linear-gradient(135deg, #ff9f43, #ff5d73); border: none; font-weight: 600; }
.bouton:disabled { opacity: .6; cursor: wait; }

/* --- accès --- */
#acces { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.carte-acces { width: min(380px, 100%); background: rgba(24, 34, 58, .85); border: 1px solid var(--bord);
  border-radius: 22px; padding: 34px 28px; text-align: center; box-shadow: var(--ombre); backdrop-filter: blur(10px); }
.carte-acces h1 { margin: 4px 0 6px; font-size: 30px; }
.carte-acces p { color: var(--doux); margin: 0 0 18px; }
.carte-acces form { display: grid; gap: 10px; }
.logo-grand { font-size: 54px; }
input, select, textarea { background: var(--fond2); border: 1px solid var(--bord); border-radius: 12px; padding: 11px 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(102, 192, 244, .18); }
.erreur { color: var(--rouge); min-height: 1.2em; margin: 10px 0 0; }

/* --- haut --- */
#appli { max-width: 1500px; margin: 0 auto; padding: 18px clamp(12px, 3vw, 34px) 60px; }
.haut { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.marque { display: flex; align-items: center; gap: 12px; }
.marque h1 { margin: 0; font-size: 26px; letter-spacing: .5px;
  background: linear-gradient(90deg, #fff, #9fd3ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.marque small { color: var(--doux); }
.logo { font-size: 36px; filter: drop-shadow(0 4px 10px rgba(102, 192, 244, .4)); }
.actions-haut { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) { .actions-haut .discret span { display: none; } }

/* --- ajout --- */
.ajout { margin: 20px 0 10px; position: relative; }
#form-ajout { display: flex; align-items: center; gap: 10px; background: rgba(24, 34, 58, .8); border: 1px solid var(--bord);
  border-radius: 18px; padding: 8px 8px 8px 18px; box-shadow: var(--ombre); }
#form-ajout:focus-within { border-color: var(--accent); }
#form-ajout input { flex: 1; border: none; background: transparent; box-shadow: none; padding: 10px 4px; font-size: 16px; min-width: 0; }
.ajout-icone { font-size: 22px; color: var(--accent); }
.astuce { color: var(--doux); font-size: 13px; margin: 8px 4px 0; }
.resultats { position: absolute; left: 0; right: 0; top: 66px; z-index: 30; background: var(--carte); border: 1px solid var(--bord);
  border-radius: 14px; box-shadow: var(--ombre); overflow: hidden; }
.resultat { display: flex; align-items: center; gap: 12px; padding: 8px 12px; cursor: pointer; border: none; width: 100%;
  background: transparent; text-align: left; }
.resultat:hover, .resultat:focus { background: var(--fond2); outline: none; }
.resultat img { width: 120px; height: 45px; object-fit: cover; border-radius: 6px; }
.resultat .prix { margin-left: auto; color: var(--doux); }
.resultat.deja { opacity: .55; }

/* --- onglets et filtres --- */
.onglets { display: flex; gap: 10px; margin: 18px 0 12px; flex-wrap: wrap; }
.onglet { padding: 12px 20px; border-radius: 14px; border: 1px solid var(--bord); background: rgba(24, 34, 58, .6);
  cursor: pointer; font-size: 16px; font-weight: 600; transition: all .15s; }
.onglet b { margin-left: 6px; background: var(--fond2); border-radius: 999px; padding: 1px 9px; font-size: 13px; }
.onglet.actif { background: linear-gradient(135deg, rgba(71, 163, 230, .35), rgba(111, 92, 255, .35)); border-color: var(--accent); }
.onglet[data-statut="fait"].actif { background: linear-gradient(135deg, rgba(91, 211, 138, .3), rgba(71, 163, 230, .25)); border-color: var(--vert); }
.onglet.recoit { transform: scale(1.08); border-color: var(--jaune); }
.filtres { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.filtres input { padding: 8px 14px; border-radius: 999px; width: 200px; }
.filtres select { padding: 8px 12px; border-radius: 999px; margin-left: auto; }
.puce { padding: 7px 13px; border-radius: 999px; border: 1px solid var(--bord); background: transparent; cursor: pointer; font-size: 13px; }
.puce.actif { background: var(--accent); color: #07111f; border-color: var(--accent); font-weight: 600; }
@media (max-width: 560px) {
  .onglets { flex-wrap: nowrap; gap: 6px; }
  .onglet { flex: 1; padding: 10px 6px; font-size: 14px; text-align: center; }
  .onglet b { margin-left: 3px; padding: 1px 6px; }
  .filtres { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .filtres > * { flex-shrink: 0; }
  .filtres input { width: 140px; }
  .astuce { display: none; }
  .marque small { display: none; }
}

/* --- grille de jaquettes --- */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; }
@media (max-width: 520px) { .grille { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
.jeu { position: relative; aspect-ratio: 2 / 3; border-radius: var(--rayon); overflow: hidden; cursor: pointer;
  background: var(--carte) center / cover; box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
  transition: transform .2s cubic-bezier(.2, .8, .3, 1.3), box-shadow .2s; animation: arrive .35s ease-out both; }
.jeu:hover, .jeu:focus-visible { transform: translateY(-6px) scale(1.03); box-shadow: 0 16px 34px rgba(0, 0, 0, .6), 0 0 0 2px var(--accent); outline: none; z-index: 2; }
@keyframes arrive { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.jeu.part { animation: part .35s ease-in forwards; pointer-events: none; }
@keyframes part { to { opacity: 0; transform: scale(.7) rotate(-4deg); } }
.jeu img.couv { width: 100%; height: 100%; object-fit: cover; display: block; }
.jeu.paysage { background: #111827; }
.jeu.paysage .flou { position: absolute; inset: -20px; background-size: cover; background-position: center; filter: blur(18px) brightness(.6); }
.jeu.paysage img.couv { position: absolute; top: 28%; height: auto; object-fit: contain; }
.jeu .sans-image { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; text-align: center; font-weight: 700;
  background: linear-gradient(160deg, #2b3d6b, #3c2b6b); }
.jeu .degrade { position: absolute; inset: auto 0 0 0; padding: 40px 10px 10px; background: linear-gradient(transparent, rgba(5, 8, 15, .92) 55%); }
.jeu .titre { font-weight: 700; font-size: 14px; line-height: 1.2; text-shadow: 0 1px 3px #000; }
.jeu .infos { display: flex; gap: 6px; margin-top: 4px; font-size: 12px; color: #c9d4ea; flex-wrap: wrap; }
.badge { position: absolute; top: 8px; padding: 3px 8px; border-radius: 8px; font-size: 12px; font-weight: 800; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }
.badge.promo { left: 8px; background: #4c6b22; color: #beee11; }
.badge.gratuit { left: 8px; background: var(--vert); color: #06210f; }
.badge.envie { right: 8px; background: rgba(255, 93, 115, .92); }
.badge.coop { left: 8px; top: auto; bottom: 64px; background: rgba(11, 15, 26, .8); font-weight: 600; }
.jeu .rapide { position: absolute; top: 40px; right: 8px; display: flex; flex-direction: column; gap: 6px; opacity: 0; transform: translateX(8px); transition: all .18s; }
.jeu:hover .rapide, .jeu:focus-within .rapide { opacity: 1; transform: none; }
@media (hover: none) { .jeu .rapide { opacity: 1; transform: none; } }
.rapide button { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .25); cursor: pointer;
  background: rgba(11, 15, 26, .82); font-size: 17px; backdrop-filter: blur(4px); transition: transform .12s; }
.rapide button:hover { transform: scale(1.15); border-color: var(--accent); }
.rapide button.ok:hover { background: var(--vert); }
.jeu.est-fait img.couv { filter: saturate(.75); }
.tampon { position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg); border: 3px solid var(--vert);
  color: var(--vert); padding: 2px 12px; border-radius: 8px; font-weight: 900; letter-spacing: 2px; background: rgba(6, 33, 15, .65); font-size: 18px; }
.vide { text-align: center; color: var(--doux); font-size: 17px; padding: 60px 20px; }
.vide big { display: block; font-size: 50px; margin-bottom: 8px; }

/* --- voiles et fiche --- */
.voile { position: fixed; inset: 0; z-index: 50; background: rgba(4, 7, 14, .72); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px; animation: fondu .2s; overflow-y: auto; }
@keyframes fondu { from { opacity: 0; } }
.fiche { position: relative; width: min(920px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--fond2);
  border: 1px solid var(--bord); border-radius: 20px; box-shadow: var(--ombre); animation: monte .25s cubic-bezier(.2, .8, .3, 1.2); }
@keyframes monte { from { transform: translateY(24px) scale(.97); opacity: 0; } }
.fiche-fond { position: absolute; inset: 0 0 auto 0; height: 300px; background-size: cover; background-position: center top;
  mask-image: linear-gradient(#000 30%, transparent); -webkit-mask-image: linear-gradient(#000 30%, transparent); opacity: .55; }
.fermer { position: absolute; top: 12px; right: 12px; z-index: 3; width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(0, 0, 0, .55); cursor: pointer; font-size: 16px; }
.fiche-tete { position: relative; display: flex; gap: 22px; padding: 110px 26px 10px; align-items: flex-end; }
.fiche-tete img { width: 170px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; box-shadow: var(--ombre); flex-shrink: 0; background: var(--carte); }
.fiche-tete img.paysage { aspect-ratio: auto; width: 260px; }
.fiche-titre h2 { margin: 0 0 4px; font-size: 28px; text-shadow: 0 2px 8px #000; }
.meta { color: var(--doux); margin: 0 0 10px; }
.puces { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.puces span { background: rgba(102, 192, 244, .14); border: 1px solid rgba(102, 192, 244, .3); border-radius: 999px; padding: 2px 10px; font-size: 12px; }
.puces span.multi { background: rgba(164, 108, 255, .18); border-color: rgba(164, 108, 255, .4); }
.puces span.prix { background: rgba(91, 211, 138, .15); border-color: rgba(91, 211, 138, .4); font-weight: 700; }
.segment { display: inline-flex; background: var(--fond); border: 1px solid var(--bord); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.segment button { border: none; background: transparent; padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.segment button.actif { background: linear-gradient(135deg, #47a3e6, #6f5cff); }
.segment button[data-statut="fait"].actif { background: linear-gradient(135deg, #2fa865, #5bd38a); color: #04170b; }
.fiche-corps { position: relative; padding: 10px 26px 26px; }
.desc { font-size: 15.5px; color: #d3dbea; }
.captures { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; margin: 6px 0 16px; scroll-snap-type: x mandatory; }
.captures img { height: 150px; border-radius: 10px; scroll-snap-align: start; cursor: zoom-in; flex-shrink: 0; }
.captures img.zoom { height: auto; width: min(860px, 85vw); cursor: zoom-out; }
.note-label { display: block; font-size: 13px; color: var(--doux); margin-bottom: 6px; }
textarea { width: 100%; resize: vertical; }
.origine { color: var(--doux); font-size: 13px; }
.fiche-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.fiche-actions.centre { justify-content: center; }
#f-envie.actif { background: rgba(255, 93, 115, .25); border-color: var(--rouge); }
@media (max-width: 640px) {
  .fiche-tete { flex-direction: column; align-items: flex-start; padding-top: 70px; }
  .fiche-tete img { width: 130px; }
  .fiche-titre h2 { font-size: 22px; }
  .fiche-corps, .fiche-tete { padding-left: 16px; padding-right: 16px; }
}

/* --- tirage --- */
.tirage { text-align: center; }
.tirage-roue { width: 240px; aspect-ratio: 2 / 3; margin: 0 auto 16px; border-radius: 16px; overflow: hidden; box-shadow: 0 0 60px rgba(255, 159, 67, .5); background: var(--carte); }
.tirage-roue img { width: 100%; height: 100%; object-fit: cover; }
.tirage-roue.tourne img { animation: secoue .1s infinite alternate; }
.tirage-roue.gagne { animation: gagne .6s ease-out; }
@keyframes secoue { from { transform: translateX(-3px) rotate(-1deg); } to { transform: translateX(3px) rotate(1deg); } }
@keyframes gagne { 0% { transform: scale(.9); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
.tirage h2 { font-size: 26px; margin: 0 0 6px; text-shadow: 0 2px 8px #000; }

/* --- panneau activité --- */
.panneau { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw); z-index: 45; background: var(--fond2);
  border-left: 1px solid var(--bord); box-shadow: var(--ombre); display: flex; flex-direction: column; animation: glisse .2s; }
@keyframes glisse { from { transform: translateX(40px); opacity: 0; } }
.panneau header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--bord); }
.panneau h3 { margin: 0; }
.panneau .fermer { position: static; }
.panneau ul { list-style: none; margin: 0; padding: 8px 18px; overflow-y: auto; }
.panneau li { padding: 9px 0; border-bottom: 1px solid rgba(38, 52, 82, .6); font-size: 14px; cursor: pointer; }
.panneau li small { display: block; color: var(--doux); font-size: 12px; }

/* --- dialogue --- */
.petite-carte { width: min(400px, 100%); background: var(--fond2); border: 1px solid var(--bord); border-radius: 18px; padding: 24px; box-shadow: var(--ombre); }
.petite-carte h3 { margin-top: 0; }
.petite-carte input { width: 100%; margin-bottom: 8px; }
.choix-noms { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

/* --- toasts --- */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: max-content; max-width: 92vw; }
.toast { background: var(--carte); border: 1px solid var(--bord); border-left: 4px solid var(--accent); border-radius: 12px;
  padding: 11px 16px; box-shadow: var(--ombre); animation: monte .25s; }
.toast.ok { border-left-color: var(--vert); }
.toast.err { border-left-color: var(--rouge); }

/* --- confettis --- */
.confetti { position: fixed; width: 8px; height: 12px; z-index: 200; pointer-events: none; border-radius: 2px; animation: tombe 1s ease-out forwards; }
@keyframes tombe { to { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; } }
.favori-zone { text-align: center; margin: 4px 0 16px; }
.favori { cursor: grab; }
