/* ==========================================================================
   Scruméo — styles de l'app (espace connecté).
   Reçoit progressivement les styles jusqu'ici inline dans les templates
   (backlog #10 : migration au fil de l'eau, pas de big-bang).
   Les tokens (--g, --s1, --tx…) viennent de base.html ; les titres héritent
   de Barlow Condensed via la règle h1,h2,h3 de base.html.
   ========================================================================== */

/* Garde-fou viewport : aucun débordement horizontal, jamais. Sur mobile,
   un contenu qui dépasse à droite élargit le canevas de la page et DÉCALE
   tout élément position:fixed (les cartes de fin étaient coupées — retour
   Mel 2026-07-14, cause : halo du coach sur la page simulation). Le
   symptôme est corrigé à la source ET interdit globalement ici. */
html { overflow-x: hidden; overflow-x: clip; }

.app-wrap { max-width: 720px; margin: 0 auto; padding: 4rem 1.5rem 3rem; }
.app-eyebrow {
  color: var(--g2); font-weight: 700; letter-spacing: .15em;
  text-transform: uppercase; font-size: .8rem; margin: 0 0 .6rem;
}
.app-title {
  font-weight: 900; text-transform: uppercase; font-size: 2.25rem;
  color: var(--tx); margin: 0 0 2.5rem; line-height: 1;
}
.app-h2 {
  font-weight: 800; text-transform: uppercase; font-size: 1.3rem;
  color: var(--tx); margin: 0 0 1rem;
}
.app-empty { color: var(--mu); }
.app-empty a { color: var(--g); }
.app-cta-row { margin-top: 2.5rem; }

/* Cartes de stats principales */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: .9rem; margin-bottom: 2.2rem;
}
.stat {
  background: var(--s1); border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px; padding: 1.4rem 1rem; text-align: center;
}
.stat__num {
  font-weight: 900; font-size: 2rem; line-height: 1; margin-bottom: .3rem;
  font-variant-numeric: tabular-nums;
}
.stat__lbl { font-size: .78rem; color: var(--mu); }
.stat--xp .stat__num { color: var(--g); }
.stat--streak .stat__num { color: var(--g2); }
.stat--etapes .stat__num { color: var(--tx); }
.stat--badges .stat__num { color: #ffca4a; }

/* Détail : ce qui a rapporté l'XP */
.breakdown { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 2.6rem; }
.bd-chip {
  background: var(--s1); border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 99px; padding: .55rem 1rem; font-size: .85rem; color: var(--mu);
}
.bd-chip b { color: var(--tx); font-weight: 800; font-variant-numeric: tabular-nums; }

/* Activité récente */
.act-list { display: flex; flex-direction: column; gap: .6rem; }
.act {
  background: var(--s1); border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px; padding: .9rem 1.3rem;
  display: flex; justify-content: space-between; align-items: center;
}
.act__date { color: var(--mu); font-size: .9rem; }
.act__xp { color: var(--g); font-weight: 700; }

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==== Page Mon compte ==================================================== */

.compte-ok {
  color: var(--g); font-weight: 700; margin: 0 0 1.2rem;
}
.compte-bloc {
  background: var(--s1); border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 14px; padding: 1.4rem 1.5rem; margin-bottom: 1rem;
}
.compte-label {
  margin: 0 0 .4rem; font-size: .75rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--mu);
}
.compte-email { margin: 0; color: var(--tx); font-weight: 600; }
.compte-aide { margin: .4rem 0 0; font-size: .8rem; color: var(--mu); }
.compte-err { margin: .4rem 0 0; font-size: .85rem; color: var(--red); }
.compte-liens {
  display: flex; gap: 1.4rem; flex-wrap: wrap; margin-top: 1.6rem;
  font-size: .92rem;
}
.compte-liens a { color: var(--mu); text-decoration: none; }
.compte-liens a:hover { color: var(--tx); text-decoration: underline; }
.compte-liens .compte-logout:hover { color: var(--red); }

/* Le composant .coach-fig (mascotte, 3 tailles) vit dans landing.css :
   il sert à l'app ET à la landing marketing (une seule définition). */

/* La carte « Coach Scruméo » du hub */
.hub-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1.25rem; align-items: stretch; }
@media (max-width: 700px) { .hub-grid { grid-template-columns: 1fr; } }
.coach-card {
  background: var(--s1); border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 18px; padding: 1.4rem; display: flex; flex-direction: column;
}
.coach-card__head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: .9rem; }
.coach-card__eyebrow {
  color: var(--g2); text-transform: uppercase; letter-spacing: .15em;
  font-size: .72rem; font-weight: 700; margin: 0 0 .5rem;
}
.coach-card__texte { color: var(--tx); font-size: .93rem; line-height: 1.55; margin: 0; }
.coach-card__cta { margin-top: auto; padding-top: 1rem; }

/* ==== Sortie de jeu : jamais de cul-de-sac après une correction ========== */

.mj-sortie {
  position: sticky; bottom: 0; z-index: 50;
  display: flex; gap: .8rem; justify-content: center; align-items: center;
  flex-wrap: wrap; padding: 1rem;
  background: linear-gradient(180deg, transparent, var(--bg, #060d17) 35%);
  margin-top: 1.5rem;
}

/* ==== Avatars de profil (les coachs, débloqués par les badges) =========== */

.avatars-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: .7rem; margin-top: .6rem;
}
@media (max-width: 460px) { .avatars-grid { grid-template-columns: repeat(2, 1fr); } }
.avatar-opt {
  position: relative; display: flex; flex-direction: column; align-items: center;
  gap: .35rem; cursor: pointer; padding: .55rem .3rem;
  background: var(--s2); border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px; transition: border-color .15s;
}
.avatar-opt input { position: absolute; opacity: 0; pointer-events: none; }
.avatar-opt img {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  border: 2px solid transparent;
}
.avatar-opt span { font-size: .68rem; color: var(--mu); text-align: center; line-height: 1.2; }
.avatar-opt:hover { border-color: rgba(57, 255, 126, .35); }
.avatar-opt.on, .avatar-opt:has(input:checked) {
  border-color: var(--g);
}
.avatar-opt:has(input:checked) img { border-color: var(--g); }
.avatar-opt--lock { cursor: default; opacity: .45; }
.avatar-opt--lock:hover { border-color: rgba(255, 255, 255, .07); }
.avatar-opt--lock img { filter: grayscale(.6); }

/* Teinte personnalisée de l'avatar : masque coloré transparent.
   Le VERT n'est pas proposé — c'est la couleur de Scruméo. */
.avatar-teinte {
  position: relative; display: inline-block;
  border-radius: 50%; overflow: hidden; line-height: 0;
}
.avatar-teinte::after {
  content: ''; position: absolute; inset: 0;
  background: var(--teinte, transparent);
  mix-blend-mode: color; opacity: .85; pointer-events: none;
}
.avatar-teinte--bleu { --teinte: #3da9ff; }
.avatar-teinte--turquoise { --teinte: #00e5c8; }
.avatar-teinte--violet { --teinte: #9b7cf4; }
.avatar-teinte--rose { --teinte: #ff5fa2; }
.avatar-teinte--orange { --teinte: #ff9950; }
.avatar-teinte--jaune { --teinte: #ffd84d; }
.avatar-teinte--rouge { --teinte: #ff5050; }

/* Pastilles de choix de couleur */
.teintes { display: flex; gap: .55rem; flex-wrap: wrap; margin-top: .5rem; }
.teinte input { position: absolute; opacity: 0; pointer-events: none; }
.teinte__pastille {
  width: 30px; height: 30px; border-radius: 50%; display: block;
  background: var(--sw); border: 2px solid transparent; cursor: pointer;
  transition: transform .12s;
}
.teinte__pastille:hover { transform: scale(1.12); }
.teinte input:checked + .teinte__pastille {
  border-color: var(--tx); box-shadow: 0 0 0 3px rgba(255, 255, 255, .15);
}

/* Interrupteur de préférence (vibrations…) */
.compte-toggle {
  display: flex; gap: .6rem; align-items: center; cursor: pointer;
  color: var(--tx); font-size: .92rem;
}
.compte-toggle input { width: 18px; height: 18px; accent-color: var(--g); }

/* Avatar dans l'en-tête du hub */
.hub-avatar {
  width: 58px; height: 58px; border-radius: 50%; object-fit: cover;
  border: 2px solid rgba(57, 255, 126, .5);
  box-shadow: 0 0 18px rgba(57, 255, 126, .25);
  flex: none;
}

/* ==== Onboarding : l'accueil du coach (première visite du hub) =========== */

.scr-onb {
  position: fixed; inset: 0; z-index: 460;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 13, 23, .88); backdrop-filter: blur(8px);
}
.scr-onb__box {
  position: relative; display: flex; gap: 2.2rem; align-items: center;
  max-width: 620px; width: 92%;
  background: var(--s1); border: 1px solid var(--line-green, rgba(57,255,126,.35));
  border-radius: 22px; padding: 2.2rem 2.4rem;
  box-shadow: 0 0 70px rgba(57, 255, 126, .15);
}
.scr-onb__close {
  position: absolute; top: .9rem; right: 1.1rem;
  background: none; border: none; color: var(--mu); font-size: 1rem;
  cursor: pointer; padding: .3rem;
}
.scr-onb__close:hover { color: var(--tx); }
.scr-onb__fig { flex: 0 0 170px; }
.scr-onb__corps { flex: 1; min-width: 0; }
.scr-onb__eyebrow {
  margin: 0 0 .6rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .2em; text-transform: uppercase; color: var(--g2);
}
.scr-onb__slide { min-height: 150px; }
.scr-onb__slide h2 {
  margin: 0 0 .7rem; font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900; font-size: 1.9rem; line-height: 1.05;
  text-transform: none; color: var(--tx);
}
.scr-onb__slide p { margin: 0; color: var(--mu); line-height: 1.6; font-size: .95rem; }
.scr-onb__dots { display: flex; gap: .45rem; margin: 1rem 0 1.2rem; }
.scr-onb__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255, 255, 255, .18);
}
.scr-onb__dot.on { background: var(--g); }
@media (max-width: 560px) {
  .scr-onb__box { flex-direction: column; text-align: center; padding: 1.8rem 1.4rem; }
  .scr-onb__fig { flex-basis: auto; max-width: 120px; }
  .scr-onb__dots { justify-content: center; }
}

/* ==== Fin d'exercice unifiée (Scr.fin) =================================== */

.scr-fin {
  position: fixed; inset: 0; z-index: 440;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 13, 23, .82); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .3s ease;
}
.scr-fin.in { opacity: 1; }
.scr-fin__box {
  display: flex; gap: 1.6rem; align-items: center;
  max-width: 520px; width: 92%;
  background: var(--s1); border: 1px solid var(--line-green, rgba(57,255,126,.35));
  border-radius: 22px; padding: 1.8rem 2rem;
  box-shadow: 0 0 60px rgba(57, 255, 126, .15);
  transform: scale(.9); transition: transform .35s cubic-bezier(.2, .9, .3, 1.3);
}
.scr-fin.in .scr-fin__box { transform: scale(1); }
.scr-fin__corps { flex: 1; min-width: 0; }
.scr-fin__titre {
  margin: 0 0 .2rem; font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900; text-transform: uppercase; font-size: 1.8rem;
  color: var(--tx); line-height: 1;
}
.scr-fin__xp { font-weight: 900; font-size: 1.3rem; color: var(--g); margin: 0 0 1rem; }
.scr-fin__mot { color: var(--mu); font-size: .9rem; margin: 0 0 1.1rem; line-height: 1.5; }
.scr-fin__stats { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.scr-fin__stat {
  background: var(--s2); border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 10px; padding: .45rem .8rem; font-size: .82rem; color: var(--mu);
}
.scr-fin__stat b { color: var(--tx); font-variant-numeric: tabular-nums; }
.scr-fin__actions { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
@media (max-width: 520px) {
  /* Carte de succès centrée et compacte (même langage que la fin de démo) —
     l'ancrage bas + grand vide sombre faisait « cassé » (retour Mel). */
  .scr-fin { padding: 1rem; }
  .scr-fin__box {
    flex-direction: column; text-align: center;
    width: 92%; max-width: 380px; padding: 1.6rem 1.3rem;
    max-height: 88vh; overflow-y: auto;
  }
  .scr-fin__box .coach-fig--buste { margin: 0 auto; }
  .scr-fin__stats { justify-content: center; }
  .scr-fin__actions { flex-direction: column; align-items: stretch; }
  .scr-fin__actions a, .scr-fin__actions button { text-align: center; }
}

/* ==== Feedback unifié : toast XP + célébration de badge (feedback.js) ==== */

.scr-toast-xp {
  position: fixed; bottom: 34px; left: 50%; z-index: 400;
  transform: translateX(-50%) translateY(16px); opacity: 0;
  background: var(--grad); color: var(--ink-on-green, #04130b);
  font-weight: 900; font-size: 1.05rem; letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  padding: .6rem 1.4rem; border-radius: 999px;
  box-shadow: 0 8px 30px rgba(57, 255, 126, .35);
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.3), opacity .35s ease;
  pointer-events: none;
}
.scr-toast-xp.in { transform: translateX(-50%) translateY(0); opacity: 1; }

.scr-badge-pop {
  position: fixed; inset: 0; z-index: 450;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 13, 23, .82); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .3s ease;
}
.scr-badge-pop.in { opacity: 1; }
.scr-badge-pop__box {
  position: relative; text-align: center; max-width: 340px; width: 90%;
  background: var(--s1); border: 1px solid var(--line-green);
  border-radius: 22px; padding: 2.6rem 2.2rem 2.2rem;
  box-shadow: 0 0 60px rgba(57, 255, 126, .18);
  transform: scale(.85); transition: transform .4s cubic-bezier(.2, .9, .3, 1.4);
}
.scr-badge-pop.in .scr-badge-pop__box { transform: scale(1); }
.scr-badge-pop__coach { display: flex; justify-content: center; margin-bottom: .6rem; }
.scr-badge-pop__halo {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  width: 180px; height: 180px; pointer-events: none;
  background: radial-gradient(circle, rgba(57, 255, 126, .3), transparent 65%);
}
.scr-badge-pop__ico {
  font-size: 4rem; line-height: 1; margin-bottom: .8rem;
  animation: scr-badge-bounce .8s cubic-bezier(.2, .9, .3, 1.4);
}
.scr-badge-pop__lbl {
  margin: 0 0 .3rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--g2, #00e5c8);
}
.scr-badge-pop__titre {
  margin: 0 0 1.6rem; font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900; text-transform: uppercase; font-size: 1.7rem;
  color: var(--tx, #e6edf6); line-height: 1.05;
}
@keyframes scr-badge-bounce {
  0% { transform: scale(0) rotate(-16deg); }
  60% { transform: scale(1.18) rotate(5deg); }
  100% { transform: scale(1) rotate(0); }
}
@media (prefers-reduced-motion: reduce) {
  .scr-toast-xp, .scr-badge-pop, .scr-badge-pop__box { transition: none; }
  .scr-badge-pop__ico { animation: none; }
}

/* ==== Fin de démo : célébration + création de compte (feedback.js) ==== */

.scr-demo {
  position: fixed; inset: 0; z-index: 460;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6, 13, 23, .85); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .3s ease;
  padding: 1rem;
}
.scr-demo.in { opacity: 1; }
.scr-demo__box {
  position: relative; text-align: center; max-width: 380px; width: 92%;
  background: var(--s1); border: 1px solid var(--line-green, rgba(57,255,126,.35));
  border-radius: 22px; padding: 2.4rem 2rem 2rem;
  box-shadow: 0 0 60px rgba(57, 255, 126, .18);
  transform: scale(.85); transition: transform .4s cubic-bezier(.2, .9, .3, 1.4);
  max-height: 92vh; overflow-y: auto;
}
.scr-demo.in .scr-demo__box { transform: scale(1); }
.scr-demo__coach { display: flex; justify-content: center; margin-bottom: .5rem; }
.scr-demo__coach .coach-fig { animation: scr-demo-bounce .7s cubic-bezier(.2, .9, .3, 1.4); }
.scr-demo__halo {
  position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  width: 200px; height: 200px; pointer-events: none;
  background: radial-gradient(circle, rgba(57, 255, 126, .3), transparent 65%);
}
.scr-demo__lbl {
  margin: 0 0 .3rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .22em; text-transform: uppercase; color: var(--g2, #00e5c8);
}
.scr-demo__titre {
  margin: 0; font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900; text-transform: uppercase; font-size: 1.5rem;
  color: var(--tx, #e6edf6); line-height: 1.05;
}
.scr-demo__xp {
  margin: .2rem 0 1rem; font-weight: 900; font-size: 2.2rem; color: var(--g);
  font-variant-numeric: tabular-nums;
  animation: scr-badge-bounce .8s cubic-bezier(.2, .9, .3, 1.4);
}
.scr-demo__mot {
  margin: 0 0 1.6rem; color: var(--mu); font-size: .92rem; line-height: 1.55;
}
.scr-demo__actions { display: flex; flex-direction: column; gap: .7rem; align-items: stretch; }
.scr-demo__actions a, .scr-demo__actions button { text-align: center; }
@keyframes scr-demo-bounce {
  0% { transform: translateY(14px) scale(.9); }
  60% { transform: translateY(-4px) scale(1.05); }
  100% { transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .scr-demo, .scr-demo__box { transition: none; }
  .scr-demo__coach .coach-fig, .scr-demo__xp { animation: none; }
}
