/* Salle de jeux NatsGaming (README.md) — l'identité reprise de l'application
   famille de Résidence (variables, entête, cartes, boutons, photos rondes,
   pastilles, toasts), sans son thème d'établissement. */

:root {
  --paper: #F4F3EC;
  --card: #FFFFFF;
  --ink: #212B25;
  --ink-soft: #5A675F;
  --pine: #2E5B4F;
  --sur-pine: #FBF8F1;
  --pine-survol: #1F4138;
  --pine-encre: #2E5B4F;
  --pine-dark: #1F4138;
  --sage: #E4ECEA;
  --honey: #C08A2A;
  --honey-soft: #F6EBD4;
  --brick: #A64435;
  --line: #D9DCD0;
  --nuit: #132520;
  --sur-nuit: #FBF8F1;
  --ok: #2F8F57;
  --ok-doux: #DDF0E3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(33,43,37,.06), 0 4px 14px rgba(33,43,37,.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font-body: "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.45; color: var(--ink);
  background: var(--paper);
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; }
button { font-family: inherit; font-size: 1rem; cursor: pointer; border: none; color: inherit; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- entête ---------- */

.entete {
  position: sticky; top: 0; z-index: 20;
  background: var(--pine); color: var(--sur-pine);
  padding: calc(.75rem + env(safe-area-inset-top, 0px)) 1rem .75rem;
  display: flex; align-items: center; gap: .7rem;
}
.entete .titre {
  font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; flex: 1;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.entete .logo { width: 30px; height: 30px; border-radius: 8px; flex: none; }
.entete select {
  font: inherit; font-weight: 700; color: var(--sur-pine); max-width: 100%;
  background: color-mix(in srgb, var(--sur-pine) 15%, transparent);
  border: none; border-radius: 10px; padding: .3rem .5rem;
}
.entete select option { color: var(--ink); }
.entete .retour {
  background: color-mix(in srgb, var(--sur-pine) 15%, transparent);
  border-radius: 999px; padding: .4rem .8rem; font-weight: 700; flex: none;
}

main.contenu {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto;
  padding: 1rem 1rem calc(1.5rem + var(--safe-bottom));
  display: flex; flex-direction: column; gap: .9rem;
}

.rubrique {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-soft); font-weight: 700; margin: .3rem 0 -.3rem;
  display: flex; justify-content: space-between; align-items: baseline; gap: .5rem;
}
.rubrique small { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ---------- cartes, boutons, pastilles (famille/css/app.css) ---------- */

.carte {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.1rem;
}
.carte.accent { border-color: color-mix(in srgb, var(--pine) 45%, var(--line));
                background: color-mix(in srgb, var(--sage) 55%, var(--card)); }
.btn {
  background: var(--pine); color: var(--sur-pine); border-radius: 12px;
  padding: .8rem 1.2rem; font-weight: 700; font-size: 1rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.geant { width: 100%; padding: 1.05rem; font-size: 1.15rem; border-radius: 14px; }
.btn.doux { background: var(--sage); color: var(--pine-dark); }
.btn.clair { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.btn.rouge { background: var(--brick); }
.btn.vert { background: var(--ok); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.lien-discret {
  background: none; color: var(--ink-soft); text-decoration: underline;
  font-size: .85rem; align-self: center; padding: .4rem;
}

.photo-ronde {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--sage); display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.5rem; color: var(--pine-dark); flex: none;
}
.photo-ronde.grande { width: 110px; height: 110px; font-size: 2.5rem; }
.photo-ronde.petite { width: 40px; height: 40px; font-size: 1.05rem; }
.photo-ronde.mini { width: 28px; height: 28px; font-size: .8rem; }

.tag { display: inline-block; border-radius: 999px; padding: .1rem .6rem; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.tag.vert { background: var(--ok-doux); color: #1E6B3E; }
.tag.miel { background: var(--honey-soft); color: #7A5314; }
.tag.gris { background: #E9E9E4; color: var(--ink-soft); }
.tag.rouge { background: #F4DEDA; color: var(--brick); }

.vide { color: var(--ink-soft); text-align: center; padding: 1rem 0; margin: 0; }
.aide { color: var(--ink-soft); font-size: .9rem; margin: 0; line-height: 1.45; }

#toast-root {
  position: fixed; bottom: calc(1.2rem + var(--safe-bottom)); left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: .5rem; width: max-content; max-width: 92vw;
}
.toast { background: var(--ink); color: #F6F4EE; border-radius: 999px; padding: .55rem 1.1rem;
         font-size: .9rem; box-shadow: var(--shadow); text-align: center; }
.toast.erreur { background: var(--brick); }

/* ---------- connexion, messages pleins ---------- */

.plein-centre { min-height: 100dvh; display: grid; place-items: center; padding: 1.2rem; }
.boite-auth { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 1rem; }
.marque { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.marque img { width: 72px; height: 72px; border-radius: 18px; box-shadow: var(--shadow); }
.marque h1 { font-size: 1.7rem; }
.marque p { margin: 0; color: var(--ink-soft); }
label.champ { display: block; margin-bottom: .85rem; }
label.champ > span { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .3rem; }
input {
  width: 100%; padding: .75rem .8rem; font: inherit; border: 1px solid var(--line);
  border-radius: 10px; background: #FDFDFB; color: var(--ink);
}
.message-plein { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.message-plein .picto-grand { font-size: 3rem; line-height: 1; }
.message-plein h2 { font-size: 1.35rem; line-height: 1.3; }
.message-plein p { margin: 0; color: var(--ink-soft); }
.chargement { width: 44px; height: 44px; border-radius: 50%;
  border: 4px solid var(--sage); border-top-color: var(--pine); animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* ---------- salle ---------- */

.membres { display: flex; flex-direction: column; gap: .55rem; }
.membre { display: flex; align-items: center; gap: .8rem; }
.membre .qui { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.membre .qui strong { font-size: 1rem; }
.membre .qui span { font-size: .85rem; color: var(--ink-soft); }
.membre.absent { opacity: .55; }
.pastille-photo { position: relative; flex: none; }
.pastille-photo .point {
  position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 50%;
  background: #9AA79E; box-shadow: 0 0 0 2.5px var(--card);
}
.pastille-photo .point.la { background: #4CAF74; }
.pastille-photo .point.joue { background: var(--honey); }

.ligne-partie { display: flex; align-items: center; gap: .8rem; }
.ligne-partie .icone-jeu { width: 44px; height: 44px; border-radius: 12px; background: var(--sage);
                           padding: 6px; flex: none; }
.ligne-partie .qui { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ligne-partie .qui strong { font-size: 1rem; }
.ligne-partie .qui span { font-size: .85rem; color: var(--ink-soft); }

.bouton-nouvelle {
  display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left;
  padding: 1rem 1.1rem; border-radius: 18px; background: var(--pine); color: var(--sur-pine);
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--pine) 80%, transparent);
}
.bouton-nouvelle .picto { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center;
  font-size: 1.5rem; background: color-mix(in srgb, var(--sur-pine) 20%, transparent); flex: none; }
.bouton-nouvelle .texte { flex: 1; display: flex; flex-direction: column; }
.bouton-nouvelle .texte strong { font-size: 1.12rem; font-family: var(--font-display); }
.bouton-nouvelle .texte span { font-size: .85rem; opacity: .85; }
.bouton-nouvelle .fleche { font-size: 1.4rem; opacity: .7; }
.bouton-nouvelle:disabled { opacity: .5; cursor: default; }
.pied { display: flex; justify-content: center; align-items: center; gap: .3rem; flex-wrap: wrap;
        color: var(--ink-soft); font-size: .85rem; margin-top: auto; padding-top: .5rem; }

/* ---------- nouvelle partie ---------- */

.grille-jeux { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .55rem; }
.tuile-jeu {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  padding: .7rem .3rem .6rem; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink);
  position: relative;
}
.tuile-jeu img { width: 42px; height: 42px; }
.tuile-jeu .nom { font-size: .85rem; font-weight: 700; text-align: center; line-height: 1.2; }
.tuile-jeu .duree { font-size: .75rem; color: var(--ink-soft); }
.tuile-jeu[aria-pressed="true"] { border: 2px solid var(--pine); padding: calc(.7rem - 1px) calc(.3rem - 1px) calc(.6rem - 1px);
  background: color-mix(in srgb, var(--sage) 70%, var(--card)); }
.tuile-jeu:disabled { opacity: .5; cursor: default; }
.tuile-jeu .bientot { position: absolute; top: 6px; right: 6px; font-size: .62rem; padding: .05rem .4rem; }

.puces { display: flex; flex-wrap: wrap; gap: .5rem; }
.puce {
  display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .8rem .3rem .3rem;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line);
  font-weight: 700; font-size: .92rem; color: var(--ink);
}
.puce .marque-puce { font-weight: 800; color: var(--ink-soft); }
.puce[aria-pressed="true"] { border: 2px solid var(--pine); padding: calc(.3rem - 1px) calc(.8rem - 1px) calc(.3rem - 1px) calc(.3rem - 1px);
  background: color-mix(in srgb, var(--sage) 70%, var(--card)); }
.puce[aria-pressed="true"] .marque-puce { color: var(--pine); }
.puce.fixe { background: var(--sage); border-color: transparent; }
.puce:disabled { opacity: .45; cursor: default; }
.puce small { font-weight: 400; color: var(--ink-soft); }

.reglage { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap;
           padding: .55rem 0; border-top: 1px solid var(--line); }
.reglage:first-of-type { border-top: none; }
.segments { display: inline-flex; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.segments button { background: none; padding: .35rem .7rem; border-radius: 8px; font-weight: 700; font-size: .88rem; color: var(--ink-soft); }
.segments button[aria-pressed="true"] { background: var(--pine); color: var(--sur-pine); }
.compte-joueurs { font-weight: 700; color: var(--pine-encre); font-size: .9rem; }

/* ---------- attente ---------- */

.liste-invites { display: flex; flex-direction: column; gap: .6rem; }
.ligne-invite { display: flex; align-items: center; gap: .8rem; }
.ligne-invite .qui { flex: 1; font-weight: 700; }
.attente-titre { display: flex; align-items: center; gap: .9rem; }
.attente-titre img { width: 56px; height: 56px; border-radius: 14px; background: var(--sage); padding: 7px; }
.attente-titre h2 { font-size: 1.4rem; }

/* ---------- feuille d'invitation ---------- */

.voile {
  position: fixed; inset: 0; z-index: 60; background: rgba(19, 37, 32, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 1rem 1rem calc(1rem + var(--safe-bottom));
  animation: apparait .18s ease-out;
}
.feuille {
  width: 100%; max-width: 440px; background: var(--card); border-radius: 22px;
  padding: 1.3rem 1.2rem 1.1rem; box-shadow: 0 20px 50px rgba(19,37,32,.3);
  display: flex; flex-direction: column; gap: .9rem; animation: monte .22s ease-out;
}
.feuille .tete-invitation { display: flex; align-items: center; gap: .9rem; }
.feuille .tete-invitation h2 { font-size: 1.2rem; line-height: 1.25; }
.feuille .tete-invitation p { margin: .15rem 0 0; color: var(--ink-soft); font-size: .9rem; }
.feuille .boutons { display: flex; gap: .6rem; }
.feuille .boutons .btn { flex: 1; }
.feuille .boutons .btn.principal { flex: 2; }
@keyframes apparait { from { opacity: 0; } }
@keyframes monte { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .voile, .feuille { animation: none; } }

/* ---------- plateau (écran commun aux jeux, maquettes 2c et 1e) ---------- */

.ecran-partie { max-width: 560px; }
.tete-partie { display: flex; align-items: center; gap: .7rem; }
.tete-partie .photos { display: flex; flex: none; }
.tete-partie .photos > * + * { margin-left: -10px; box-shadow: 0 0 0 2px var(--paper); }
.tete-partie .qui { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tete-partie .qui strong { font-family: var(--font-display); font-size: 1.1rem; line-height: 1.2; }
.statut-partie { font-size: .9rem; font-weight: 700; color: var(--ink-soft); }
.statut-partie.a-moi { color: var(--ok); }
.joueurs-partie { display: flex; gap: .4rem; flex-wrap: wrap; }
.joueur-partie {
  display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .65rem .2rem .2rem;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .85rem; font-weight: 700;
}
.joueur-partie.trait { border: 2px solid var(--ok); padding: calc(.2rem - 1px) calc(.65rem - 1px) calc(.2rem - 1px) calc(.2rem - 1px); }
.joueur-partie.parti { opacity: .45; text-decoration: line-through; }
.joueur-partie .score { background: var(--sage); border-radius: 999px; padding: 0 .45rem; font-size: .8rem; }
.zone-jeu { width: 100%; display: flex; justify-content: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.consigne { text-align: center; color: var(--ink-soft); font-size: .95rem; margin: 0; min-height: 1.4em; }
.dernier-coup { display: flex; gap: .7rem; align-items: center; font-size: .9rem; line-height: 1.4;
                padding: .7rem .9rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.dernier-coup .fleche { font-size: 1.1rem; color: var(--pine-encre); }
.actions-partie { display: flex; gap: .6rem; margin-top: auto; }
.actions-partie .btn { padding: .95rem .8rem; }
.actions-partie .annuler { flex: 1; }
.actions-partie .valider { flex: 2; }
.actions-partie .valider:not(:disabled) { background: var(--ok); color: #fff; }

.fin-partie { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.fin-partie .picto-fin { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center;
  font-size: 2.6rem; background: var(--card); border: 4px solid color-mix(in srgb, var(--ok) 55%, transparent); }
.fin-partie h2 { font-size: 1.6rem; }
.fin-partie p { margin: 0; color: var(--ink-soft); }
.fin-partie .boutons { display: flex; flex-direction: column; gap: .6rem; width: 100%; max-width: 360px; margin-top: .4rem; }

/* ---------- accueil, invitation, lien personnel (accueil.js) ---------- */

.accueil { padding-top: calc(1.4rem + env(safe-area-inset-top, 0px)); }
.titre-carte { font-size: 1.15rem; margin-bottom: .35rem; }
.carte .aide + .champ, .carte .aide + label.champ { margin-top: .8rem; }
.saisie-code { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem;
               letter-spacing: .18em; text-transform: uppercase; }
.entete .action { margin-left: auto; }
.vide .btn { margin-top: .6rem; }
.centre { text-align: center; }

.tete-feuille { display: flex; align-items: center; gap: .6rem; }
.tete-feuille h2 { font-size: 1.25rem; flex: 1; }
.fermer-feuille { background: var(--paper); border-radius: 999px; width: 2.2rem; height: 2.2rem;
                  font-weight: 700; color: var(--ink-soft); flex: none; }
.code-salon {
  font-family: var(--font-display); font-weight: 700; font-size: 2.4rem; letter-spacing: .2em;
  text-align: center; color: var(--pine-dark); background: var(--sage); border-radius: 14px;
  padding: .5rem .5rem .5rem .9rem; user-select: all; -webkit-user-select: all;
}
.qr { display: flex; justify-content: center; }
.qr svg { width: 180px; height: 180px; background: #fff; border-radius: 10px; }
.lien-copie { font-size: .85rem; color: var(--ink-soft); }
.boutons-feuille { display: flex; flex-direction: column; gap: .55rem; }
.zone-lien { display: flex; flex-direction: column; gap: .7rem; }
.feuille { max-height: calc(100dvh - 2rem); overflow-y: auto; }

/* ---------- parties sauvegardées (différé) ---------- */

.ligne-sauvegardee { width: 100%; text-align: left; background: none; padding: .2rem 0; color: inherit; }
.ligne-sauvegardee:disabled { opacity: .6; cursor: default; }
