/* =========================================================================
   POTOS — Comptes et mode invité (lot 13a) : bouton « Se connecter », mot de l'invité, fenêtre de connexion /
   inscription / profil (js/comptes.js, js/comptes-ui.js), encart invité de l'écran de fin.
   Charte « Soirée jeux » (docs/theme-soiree-jeux.md §5) : jetons de css/theme.css seulement (sombre ET clair),
   zones tactiles ≥ 44 px, animations transform / opacity seulement (docs/fluidite.md).
   ========================================================================= */

/* ---------- Bouton de l'en-tête : « Se connecter » (invité) / mon avatar (compte) ---------- */
.auth-entry {
  position: relative; display: inline-flex; align-items: center; gap: 7px; flex: none; height: 44px; padding: 0 14px 0 10px; cursor: pointer;
  border-radius: var(--r-pill); font: 700 .92rem/1 var(--font-display); color: var(--on-accent); background: var(--accent);
  border: 0; box-shadow: inset 0 -3px 0 rgb(0 0 0 / .18); transition: transform .15s var(--spring);
  white-space: nowrap;
}
.auth-entry[hidden] { display: none; }
.auth-entry:active { transform: scale(.95); }
.auth-entry:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.auth-entry .ae-ico { font-size: 17px; line-height: 1; }
.auth-entry.is-membre { padding: 0 12px 0 4px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-2); box-shadow: none; }
.auth-entry .ae-av { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: var(--surface-3); }
.auth-entry .ae-av svg { width: 36px; height: 36px; display: block; }
.auth-entry.is-membre .ae-txt { max-width: 9em; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.auth-entry .ae-point { position: absolute; top: 4px; left: 32px; width: 11px; height: 11px; border-radius: 50%; background: var(--warn); border: 2px solid var(--surface-2); }
/* Téléphone : le compte n'a que son avatar ; l'invité garde « Se connecter » (le portefeuille, vide, laisse la place) */
@media (max-width: 639.98px) {
  .auth-entry.is-membre { width: 44px; padding: 0; justify-content: center; }
  .auth-entry.is-membre .ae-txt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .auth-entry .ae-point { left: 30px; top: 2px; }
}
@media (max-width: 399.98px) {
  .auth-entry.is-invite { height: 40px; padding: 0 11px 0 8px; gap: 5px; font-size: .86rem; }
  .auth-entry.is-invite .ae-ico { font-size: 15px; }
  .auth-entry.is-membre { width: 40px; height: 40px; }
  .auth-entry .ae-av, .auth-entry .ae-av svg { width: 32px; height: 32px; }
}
/* Invité : portefeuille vide caché (« Se connecter » prend sa place) */
body.compte-invite [data-wallet-chip] { display: none !important; }

/* ---------- Mot de l'invité (accueil) ---------- */
.guest-note {
  display: flex; align-items: flex-start; gap: 8px; margin: 14px 0 0; padding: 10px 12px; text-align: left;
  font: 500 .86rem/1.4 var(--font-ui); color: var(--muted); background: rgb(var(--accent-rgb) / .08);
  border: 1px dashed rgb(var(--accent-rgb) / .45); border-radius: var(--r-md);
}
.guest-note[hidden] { display: none; }
.guest-note .gn-ico { flex: none; font-size: 1rem; line-height: 1.35; }
.guest-note .link-btn { font-size: inherit; color: var(--accent-text); font-weight: 700; padding: 0; min-height: 0; }

/* ---------- Fenêtre ---------- */
.cpt-voile {
  position: fixed; inset: 0; z-index: 97; /* au-dessus des règles (96) : ouverte à la demande du joueur */ background: rgb(0 0 0 / .55); opacity: 0; transition: opacity .22s ease;
  display: flex; align-items: flex-end; justify-content: center;
}
.cpt-voile[hidden] { display: none; }
.cpt-voile.is-ouvert { opacity: 1; }
body.cpt-ouvert { overflow: hidden; }
.cpt-carte:focus { outline: none; }
.cpt-carte {
  position: relative; width: 100%; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); color: var(--text); background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0; box-shadow: var(--ombre-3); border: 1px solid var(--line);
  transform: translateY(100%); transition: transform .3s var(--ease-out, cubic-bezier(.2, .8, .2, 1));
}
.cpt-voile.is-ouvert .cpt-carte { transform: none; }
@media (min-width: 640px) {
  .cpt-voile { align-items: center; padding: 24px; }
  .cpt-carte { width: min(440px, 100%); max-height: 88vh; padding: 22px 26px 24px; border-radius: var(--r-xl); transform: translateY(18px) scale(.98); opacity: 0; transition: transform .26s var(--ease-out, ease), opacity .2s; }
  .cpt-voile.is-ouvert .cpt-carte { transform: none; opacity: 1; }
  .cpt-poignee { display: none; }
}
@media (prefers-reduced-motion: reduce) { .cpt-voile, .cpt-carte { transition: none; } }
.cpt-poignee { width: 42px; height: 5px; margin: 0 auto 10px; border-radius: 3px; background: var(--line-2); }
.cpt-fermer { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; font-size: 16px; }
.cpt-contenu { display: flex; flex-direction: column; gap: 12px; }
.cpt-titre { margin: 2px 44px 0 0; font: 700 1.45rem/1.15 var(--font-display); }
.cpt-sous { margin: -4px 0 0; font-size: .92rem; line-height: 1.45; color: var(--muted); }
.cpt-sous b, .cpt-titre + .cpt-sous b { color: var(--text); }

.cpt-raison { margin: 0; padding: 10px 12px; font-size: .9rem; line-height: 1.45; background: rgb(var(--accent-rgb) / .12); border-radius: var(--r-md); border-left: 3px solid var(--accent); }
.cpt-avantages { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; font-size: .9rem; color: var(--muted); }
.cpt-avantages li { display: flex; gap: 8px; align-items: center; }
.cpt-avantages span { width: 22px; text-align: center; }

/* Fournisseurs d'identité (lot 13b) : un bouton par fournisseur, aux couleurs de sa charte */
.cpt-fournisseurs { display: grid; gap: 8px; }
.cpt-fournisseur {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 0 14px; cursor: pointer;
  font: 600 1rem/1 var(--font-ui); color: var(--ff); background: var(--fb); border: 1px solid var(--fl); border-radius: var(--r-md);
  transition: transform .12s;
}
.cpt-fournisseur:active { transform: scale(.98); }
.cpt-fournisseur[aria-disabled="true"] { opacity: .55; cursor: default; }
.cpt-fournisseur em { flex: none; font: 600 .7rem/1 var(--font-ui); font-style: normal; padding: 3px 6px; border-radius: var(--r-pill); background: rgb(0 0 0 / .14); }
.cpt-f-ico { display: inline-grid; place-items: center; width: 22px; height: 22px; font-size: 18px; }
.cpt-f-ico svg { width: 22px; height: 22px; }
.cpt-fournisseurs.is-lier .cpt-fournisseur { min-height: 44px; font-size: .92rem; }
/* Lot 13b — chartes des fournisseurs : variante sombre (Google #131314, Apple blanc), polices conseillées, logos */
:root:not([data-theme="light"]) .cpt-fournisseur { color: var(--ffd, var(--ff)); background: var(--fbd, var(--fb)); border-color: var(--fld, var(--fl)); }
.cpt-fournisseur[data-marque="google"] { font-family: Roboto, var(--font-ui); font-weight: 500; }
.cpt-fournisseur[data-marque="apple"] { font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", var(--font-ui); font-weight: 500; }
.cpt-fournisseur:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.cpt-fournisseur.is-attente { opacity: .7; pointer-events: none; }
.cpt-f-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cpt-l-ico[data-marque] svg { width: 22px; height: 22px; }
.cpt-ou { margin: 2px 0; font-size: .8rem; }

/* Formulaires */
.cpt-form { display: flex; flex-direction: column; gap: 12px; }
.cpt-champ { display: block; }
.cpt-champ .field input { font-size: 1rem; font-weight: 500; }
.cpt-champ .field input[aria-invalid="true"] { color: var(--danger-text); }
.cpt-champ .field:has(input[aria-invalid="true"]) { border-color: var(--danger); }
.cpt-oeil { font-size: 15px; }
.cpt-aide { display: block; margin: 5px 2px 0; font-size: .8rem; line-height: 1.4; color: var(--faint); }
p.cpt-aide { margin: 0; }
.cpt-lien-droite { align-self: flex-end; margin-top: -6px; font-size: .84rem; }
.cpt-centre { align-self: center; }
.cpt-erreur { margin: 0; padding: 9px 12px; font-size: .88rem; line-height: 1.4; color: var(--danger-text); background: rgb(var(--danger-rgb, 255 90 110) / .1); border-radius: var(--r-sm); border-left: 3px solid var(--danger); }
.cpt-erreur[hidden] { display: none; }
.cpt-case { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 2px; font-size: .9rem; line-height: 1.4; cursor: pointer; }
.cpt-case input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.cpt-case input[aria-invalid="true"] { outline: 2px solid var(--danger); outline-offset: 2px; }
.cpt-case a, .cpt-legal a, .cpt-aide a, .cpt-mention a { color: var(--accent-text); text-underline-offset: 3px; }
.cpt-mention { margin: 0; font-size: .78rem; line-height: 1.4; color: var(--faint); }
.cpt-bas { margin: 2px 0 0; text-align: center; font-size: .9rem; color: var(--muted); }
.cpt-bas .link-btn { font-size: inherit; color: var(--accent-text); }
.cpt-magique { gap: 8px; }
.cpt-dev { margin: 0; padding: 9px 12px; font-size: .8rem; line-height: 1.45; color: var(--muted); background: rgb(var(--accent-3-rgb, 169 139 255) / .12); border-radius: var(--r-sm); }
.cpt-dev code { font-size: .78rem; }
.cpt-force { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: -6px; }
.cpt-force i { height: 4px; border-radius: 2px; background: var(--line); transition: background-color .2s; }
.cpt-force[data-niveau="1"] i:nth-child(1) { background: var(--danger); }
.cpt-force[data-niveau="2"] i:nth-child(-n+2) { background: var(--warn); }
.cpt-force[data-niveau="3"] i { background: var(--ok); }
.btn[aria-busy="true"] { opacity: .75; }

/* Profil */
.cpt-profil-tete { display: flex; gap: 12px; align-items: center; margin-right: 40px; }
.cpt-profil-tete .cpt-titre { margin-right: 0; }
.cpt-avatar { flex: none; width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--surface-3); display: grid; place-items: center; font-size: 34px; }
.cpt-avatar svg { width: 64px; height: 64px; }
.cpt-solde { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 4px 0 0; font-size: .86rem; color: var(--muted); }
.cpt-solde b { color: var(--text); font-family: var(--font-display); }
.cpt-alerte { padding: 11px 13px; font-size: .9rem; line-height: 1.45; background: rgb(var(--warn-rgb, 255 168 61) / .12); border-left: 3px solid var(--warn); border-radius: var(--r-sm); }
.cpt-section { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.cpt-section h3 { margin: 0; font: 600 .8rem/1.2 var(--font-ui); text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.cpt-liste { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.cpt-ligne { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }
.cpt-ligne .btn-sm { flex: none; min-height: 36px; padding: .4em .75em; font-size: .84rem; }
.cpt-l-ico { flex: none; width: 26px; text-align: center; font-size: 18px; }
.cpt-l-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cpt-l-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.cpt-l-txt small { font-size: .78rem; color: var(--faint); }
.cpt-charge { color: var(--faint); font-size: .86rem; }
.cpt-ok { color: var(--ok-text); font-weight: 600; }
.cpt-attention { color: var(--warn-text); font-weight: 600; }
.cpt-journal summary { cursor: pointer; font-size: .86rem; color: var(--muted); min-height: 40px; display: flex; align-items: center; gap: 6px; list-style: none; }
.cpt-journal summary::-webkit-details-marker { display: none; }
.cpt-journal summary::before { content: "▸"; display: inline-block; transition: transform .15s; }
.cpt-journal[open] summary::before { transform: rotate(90deg); }
.cpt-journal ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font-size: .84rem; }
.cpt-journal li { display: flex; justify-content: space-between; gap: 8px; }
.cpt-journal small { color: var(--faint); text-align: right; }
.cpt-legal { margin: 2px 0 0; text-align: center; font-size: .8rem; color: var(--faint); }
.cpt-danger-txt { color: var(--danger-text); }
.cpt-sortie { margin-top: 4px; }

/* ---------- Écran de fin : ce que l'invité aurait gagné, et « Créer mon compte » ---------- */
.end-reward.is-invite { flex-wrap: wrap; border-style: dashed; }
.end-reward.is-invite .er-amt { color: var(--muted); }
.end-reward.is-invite .er-amt s { color: var(--text); text-decoration-thickness: 2px; text-decoration-color: rgb(var(--accent-rgb) / .9); }
.end-reward .er-invite { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 4px; font-size: .86rem; line-height: 1.4; color: var(--muted); }
.end-reward .er-invite .btn { min-height: 44px; }

/* En-tête de l'accueil au téléphone : un bouton de plus (compte) sans déborder (mesuré à 360, 375 et 412 px) */
@media (max-width: 639.98px) {
  body.compte-membre #screen-home > header > div, body.compte-appareil #screen-home > header > div { gap: 6px; }
  body.compte-membre #screen-home > header .shop-entry, body.compte-membre #screen-home > header .icon-btn,
  body.compte-appareil #screen-home > header .shop-entry, body.compte-appareil #screen-home > header .icon-btn { width: 40px; min-width: 40px; height: 40px; }
  .auth-entry.is-membre { width: 40px; height: 40px; }
}
@media (max-width: 399.98px) { #screen-home > header > div { gap: 4px; } }
/* Très petits téléphones avec un compte : le bouton clair / sombre passe dans le profil (fenêtre « Mon compte ») */
@media (max-width: 379.98px) { body.compte-membre #screen-home > header .theme-btn, body.compte-appareil #screen-home > header .theme-btn { display: none; } }
