/* ==========================================================================
   Composants : navigation, menu utilisateur, panneau, bouton, fenêtres
   ========================================================================== */

/* ---- Pastilles bleu nuit (burger, menu utilisateur, navigation) ----------- */
.burger, .usermenu__btn, .mainnav ul {
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  box-shadow: 0 0.4em 1.2em rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.burger {
  position: absolute; left: 3.5cqw; top: 3.8cqw;
  width: 12.5cqw; height: 9.5cqw; min-width: 46px; min-height: 40px;
  border-radius: 999px;
  display: grid; place-items: center;
}
.burger svg { width: 52%; height: 52%; }

.usermenu { position: absolute; right: 3.5cqw; top: 3.8cqw; }
.usermenu__btn {
  display: flex; align-items: center; gap: 0.4em;
  height: 9.5cqw; min-height: 40px;
  padding: 0 0.75em 0 0.7em;
  border-radius: 999px;
  font-size: clamp(14px, 3.9cqw, 20px);
  font-weight: 600;
}
.usermenu__avatar { width: 1.35em; height: 1.35em; }
.usermenu__chev { width: 0.9em; height: 0.9em; transition: transform .2s; }
.usermenu__btn[aria-expanded="true"] .usermenu__chev { transform: rotate(180deg); }
.usermenu__list {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 190px;
  padding: 6px; border-radius: 14px;
  background: #101c50; border: 1px solid var(--nav-border);
  box-shadow: 0 14px 30px rgba(0,0,0,.45);
}
.usermenu__list button {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 9px; font-size: 16px;
}
.usermenu__list button:hover, .usermenu__list button:focus-visible { background: rgba(255,255,255,.1); box-shadow: none; }

/* ---- Navigation principale (desktop) -------------------------------------- */
.mainnav ul { display: flex; align-items: center; border-radius: 999px; }
.mainnav a {
  display: flex; align-items: center; gap: .42em;
  border-radius: 999px; white-space: nowrap;
  color: #fff; font-weight: 600;
  transition: background-color .2s, box-shadow .2s;
}
.mainnav a svg { width: 1.3em; height: 1.3em; flex: none; }
.mainnav a:hover { background: rgba(255,255,255,.08); }
.mainnav a.is-active {
  background: linear-gradient(180deg, #c81a24, #8f0c13);
  box-shadow:
    inset 0 0 0 2px #ff5a4d,
    inset 0 2px 0 rgba(255,255,255,.25),
    0 0 14px 2px rgba(255,64,48,.75),
    0 0 30px 6px rgba(255,40,30,.35);
}

/* ---- Panneau de progression ------------------------------------------------ */
.panel {
  border-style: solid;
  border-width: 4.2cqw;
  border-image-source: url("../assets/images/ui/panel-mobile@2x.webp");
  border-image-slice: 84 fill;
  border-image-repeat: stretch;
  filter: drop-shadow(0 1.2cqw 1.5cqw rgba(0,0,0,.5));
}
.panel__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-areas: "streak jokers" "badges badges" "tickets tickets";
  margin: -1cqw -0.5cqw;
}
.stat {
  position: relative;
  display: grid; align-items: center;
  grid-template-columns: auto 1fr auto;
  gap: 0 2cqw;
  padding: 2cqw 1.5cqw;
  text-align: left;
  border-radius: 12px;
  transition: background-color .2s;
}
.stat:hover { background: rgba(255,255,255,.04); }
.stat--streak  { grid-area: streak; }
.stat--jokers  { grid-area: jokers; grid-template-columns: 1fr auto; }
.stat--badges  { grid-area: badges; grid-template-columns: 1fr auto; }
.stat--tickets { grid-area: tickets; grid-template-columns: auto auto 1fr auto; }

/* Séparateurs dorés */
.stat--jokers::before {
  content: ""; position: absolute; left: 0; top: 16%; bottom: 16%; width: 2px;
  background: linear-gradient(transparent, #c9953f 20% 80%, transparent);
}
.stat--badges::before, .stat--tickets::before {
  content: ""; position: absolute; left: 3%; right: 3%; top: 0; height: 2px;
  background: linear-gradient(90deg, transparent, #c9953f 8% 92%, transparent);
}

.stat__icon { width: 10.5cqw; height: auto; filter: drop-shadow(0 0.4cqw 0.5cqw rgba(0,0,0,.4)); }
.stat--jokers .stat__icon { display: none; }
.stat--tickets .stat__icon { width: 12cqw; }
.stat__body { display: flex; flex-direction: column; gap: 0.6cqw; min-width: 0; }
.stat--jokers .stat__body, .stat--badges .stat__body { align-items: center; }
.stat__label { display: flex; align-items: center; gap: .35em; font-size: clamp(14px, 5cqw, 24px); font-weight: 600; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.stat--badges .stat__label { align-self: flex-start; }
.stat__info { width: 1em; height: 1em; opacity: .7; }
.stat__value { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: .25em; line-height: .95; text-shadow: 0 2px 2px rgba(0,0,0,.45); }
.stat__value strong { font-size: clamp(30px, 12cqw, 58px); font-weight: 700; color: var(--cream); }
.stat__unit { font-size: clamp(18px, 6.6cqw, 32px); color: var(--gold-300); font-weight: 700; }
.stat__sub { font-size: clamp(13px, 4.5cqw, 22px); color: #fff; font-weight: 600; }
.stat--streak .stat__value { display: grid; grid-template-columns: auto auto; justify-content: start; column-gap: 1.6cqw; align-items: end; }
.stat--streak .stat__value strong { grid-row: 1 / 3; line-height: .85; }
.stat--streak .stat__unit { line-height: 1; }
.stat--streak .stat__sub { line-height: 1.1; }
.stat--streak .stat__go { display: none; }
.stat--streak { grid-template-columns: auto 1fr; gap: 0 1.5cqw; }
.stat__caption { font-size: clamp(14px, 4.8cqw, 23px); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.stat__of { font-size: clamp(18px, 6.6cqw, 32px); color: #fff; font-weight: 700; }

.stat__go { color: var(--gold-300); width: 6cqw; height: 6cqw; display: grid; place-items: center; }
.stat__go svg { width: 100%; height: 100%; }
.go-d { display: none; }

/* Jokers et tickets : pastilles */
.pips { display: flex; align-items: center; gap: 1.6cqw; }
.pips img { width: 8.6cqw; height: auto; filter: drop-shadow(0 0.3cqw 0.3cqw rgba(0,0,0,.4)); }
.pips--tickets { gap: 0.6cqw; justify-content: flex-end; }
.pips--tickets img, .pips--tickets svg { width: 9cqw; height: auto; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; gap: 1cqw; }
.badge { position: relative; display: flex; flex-direction: column; align-items: center; gap: 1cqw; }
.badge img { width: 19cqw; max-width: 104px; height: auto; filter: drop-shadow(0 .5cqw .6cqw rgba(0,0,0,.45)); transition: filter .3s; }
.badge.is-locked img { filter: grayscale(1) brightness(.75) drop-shadow(0 .5cqw .6cqw rgba(0,0,0,.45)); }
.badge__check {
  position: absolute; right: 8%; top: 52%;
  width: 7.5cqw; height: 7.5cqw; max-width: 40px; max-height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #4fd25a, #1c9a2c); border: 2px solid #fff; color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,.4);
}
.badge__check svg { width: 62%; height: 62%; }
.badge--native-check .badge__check { opacity: 0; } /* coche déjà présente sur l'image provisoire */
.badge__label { font-size: clamp(13px, 4.6cqw, 22px); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ---- Bouton principal ----------------------------------------------------- */
.cta {
  position: relative;
  width: 100%;
  min-height: 56px;
  height: 15cqw;
  display: flex; align-items: center; justify-content: center; gap: 4%;
  border-radius: 999px;
  border: 0.55cqw solid #ffd779;
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 45%),
    linear-gradient(180deg, #9a5217 0%, #6b300a 55%, #521f04 100%);
  box-shadow:
    inset 0 0 0 0.35cqw rgba(120,55,10,.9),
    inset 0 -0.8cqw 1.4cqw rgba(0,0,0,.35),
    0 0 1cqw 0.15cqw rgba(255,184,50,.75),
    0 1cqw 2cqw rgba(0,0,0,.45);
  color: var(--cream);
  font-size: clamp(17px, 5.7cqw, 30px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .015em;
  text-shadow: 0 2px 2px rgba(0,0,0,.45);
  transition: transform .15s var(--ease-out), filter .2s, box-shadow .2s;
}
.cta__icon { width: 1.6em; height: 1.6em; flex: none; }
.cta__arrow { width: 1.15em; height: 1.15em; flex: none; }
.cta__label { white-space: nowrap; }
@media (hover: hover) { .cta:hover { filter: brightness(1.12); } .cta:hover .cta__arrow { transform: translateX(.15em); } }
.cta__arrow { transition: transform .2s var(--ease-out); }
.cta:active { transform: translateY(2px) scale(.985); filter: brightness(.95); }
.cta.is-done { border-color: #b9e58a; }

/* ---- Fenêtres d'information ---------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; }
.modal__scrim, .drawer__scrim { position: absolute; inset: 0; background: rgba(4,8,30,.66); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal__box {
  position: relative;
  width: min(480px, 100%);
  max-height: calc(100svh - 32px); overflow: auto;
  padding: 28px 24px 24px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,0) 30%),
    linear-gradient(180deg, #5b2e16, #3d1d0c);
  border: 3px solid #b8783a;
  box-shadow: inset 0 0 0 2px #2a1206, 0 24px 60px rgba(0,0,0,.6);
  font-weight: 500;
}
.modal__close { position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--gold-200); }
.modal__close svg { width: 22px; height: 22px; }
.modal__close:hover { background: rgba(255,255,255,.08); }
.modal h2 { font-size: 30px; font-weight: 700; color: var(--gold-300); margin: 0 40px 10px 0; line-height: 1.05; }
.modal p { font-size: 18px; line-height: 1.4; color: #fbeedd; margin: 0 0 12px; }
.modal ul.list { display: grid; gap: 8px; margin: 12px 0; }
.modal ul.list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.22); font-size: 17px; }
.modal .tag { font-weight: 700; }
.modal .tag--ok { color: #9be06b; } .modal .tag--ko { color: #ff8f84; } .modal .tag--wait { color: var(--gold-300); }
.modal__hero { display: flex; justify-content: center; margin: 0 0 12px; }
.modal__hero img { width: 96px; height: auto; }
.modal__actions { display: flex; gap: 10px; margin-top: 18px; }
.modal__actions .cta { height: 56px; font-size: 20px; border-width: 2px; }
.btn-secondary { min-height: 48px; padding: 0 18px; border-radius: 999px; border: 2px solid rgba(255,215,121,.6); color: var(--gold-200); font-size: 18px; }
.demo-flag { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 6px; background: rgba(246,185,40,.18); color: var(--gold-300); font-size: 13px; }

/* ---- Menu mobile ----------------------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 190; }
.drawer__panel {
  position: absolute; left: 0; top: 0; bottom: 0; width: min(320px, 84vw);
  padding: max(18px, env(safe-area-inset-top)) 16px 24px;
  background: linear-gradient(180deg, #13225e, #0a1440);
  border-right: 1px solid var(--nav-border);
  box-shadow: 20px 0 40px rgba(0,0,0,.5);
  animation: drawer-in .28s var(--ease-out);
}
.drawer__close { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 14px; background: var(--nav-bg); border: 1px solid var(--nav-border); }
.drawer__close svg { width: 22px; height: 22px; }
.drawer ul { display: grid; gap: 6px; }
.drawer a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-radius: 999px; font-size: 21px; }
.drawer a svg { width: 24px; height: 24px; }
.drawer a.is-active { background: linear-gradient(180deg, #c81a24, #8f0c13); box-shadow: inset 0 0 0 2px #ff5a4d, 0 0 14px rgba(255,64,48,.6); }

/* ---- Toast, chargement, erreur -------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 110px; z-index: 210;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px);
  padding: 12px 18px; border-radius: 14px;
  background: #101c50; border: 1px solid var(--nav-border); box-shadow: 0 10px 30px rgba(0,0,0,.5);
  font-size: 17px; transition: opacity .25s, transform .25s var(--ease-out);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.loader { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--night-900); transition: opacity .4s, visibility .4s; }
.loader span { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(255,215,106,.25); border-top-color: var(--gold-300); animation: spin .9s linear infinite; }
body:not(.is-loading) .loader { opacity: 0; visibility: hidden; }
.load-error { position: fixed; left: 50%; top: 40%; transform: translateX(-50%); z-index: 310; text-align: center; padding: 22px; border-radius: 16px; background: #3d1d0c; border: 2px solid #b8783a; font-size: 18px; }
.load-error button { margin-top: 12px; min-height: 46px; padding: 0 20px; border-radius: 999px; background: var(--gold-300); color: #3a1d00; font-weight: 700; }

/* ---- Barre de démonstration ----------------------------------------------- */
.demo { position: fixed; left: 10px; bottom: 10px; z-index: 180; font-size: 14px; font-weight: 500; }
.demo__toggle { min-height: 34px; padding: 0 12px; border-radius: 999px; background: rgba(246,185,40,.92); color: #3a1d00; font-weight: 700; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.demo__panel { display: none; position: absolute; left: 0; bottom: 44px; width: 250px; padding: 12px; border-radius: 12px; background: #0f1a4c; border: 1px solid var(--nav-border); box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.demo[data-open="true"] .demo__panel { display: grid; gap: 8px; }
.demo__title { color: var(--gold-300); font-weight: 700; }
.demo label { display: grid; gap: 4px; }
.demo select, .demo__panel button { min-height: 36px; border-radius: 8px; padding: 0 10px; font: inherit; }
.demo select { background: #fff; color: #111; border: 0; }
.demo__panel button { background: rgba(255,255,255,.1); text-align: left; }
.demo__panel button:hover { background: rgba(255,255,255,.18); }

/* Pseudo long : tronqué pour ne pas chevaucher le logo */
.usermenu__name { max-width: 22cqw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 900px) and (min-aspect-ratio: 6/5) { .usermenu__name { max-width: calc(var(--u) * 110); } }
