/* Mise en page : une colonne étroite pour l'accueil, deux colonnes (plan | chat) pour le trio sur grand écran.
   Trois pastilles (basilic, moutarde, tomate) = les trois membres d'un trio. */
:root {
  --fond: #f3f5ee;
  --surface: #ffffff;
  --surface-2: #e9ede2;
  --trait: #d5dccb;
  --texte: #1c241f;
  --doux: #5c6a60;
  --basilic: #2f6b4f;
  --basilic-encre: #ffffff;
  --moutarde: #c98f12;
  --tomate: #c4482f;
  --prune: #7a4f93;
  --ardoise: #3f6a9c;
  --bulle-moi: #2f6b4f;
  --bulle-moi-texte: #ffffff;
  --bulle: #e9ede2;
  --succes-fond: #e1efe5;
  --erreur-fond: #fbe7e2;

  --f-titre: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --f-texte: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #141a16; --surface: #1d2520; --surface-2: #26302a; --trait: #34403a;
    --texte: #eef2ea; --doux: #a3b0a6;
    --basilic: #6cbf93; --basilic-encre: #0e1a13; --moutarde: #f0bd4a; --tomate: #f07c63;
    --prune: #c09ad6; --ardoise: #86aee0;
    --bulle-moi: #2f6b4f; --bulle-moi-texte: #f3f8f4; --bulle: #26302a;
    --succes-fond: #1f3a2b; --erreur-fond: #3d211b;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #141a16; --surface: #1d2520; --surface-2: #26302a; --trait: #34403a;
  --texte: #eef2ea; --doux: #a3b0a6;
  --basilic: #6cbf93; --basilic-encre: #0e1a13; --moutarde: #f0bd4a; --tomate: #f07c63;
  --prune: #c09ad6; --ardoise: #86aee0;
  --bulle-moi: #2f6b4f; --bulle-moi-texte: #f3f8f4; --bulle: #26302a;
  --succes-fond: #1f3a2b; --erreur-fond: #3d211b;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--fond);
  color: var(--texte);
  font-family: var(--f-texte);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--f-titre); line-height: 1.05; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(34px, 8vw, 52px); font-weight: 800; letter-spacing: -0.02em; }
h1 em { font-style: normal; color: var(--basilic); }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--moutarde); outline-offset: 2px; border-radius: 6px; }

.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- barre & pied */
.barre, .page, .pied { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 16px; }
.barre { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--f-titre); font-weight: 800; font-size: 22px; color: var(--texte); text-decoration: none; }
.pastilles { display: inline-flex; }
.pastilles i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--fond); margin-left: -5px; }
.pastilles i:nth-child(1) { background: var(--basilic); margin-left: 0; }
.pastilles i:nth-child(2) { background: var(--moutarde); }
.pastilles i:nth-child(3) { background: var(--tomate); }
.moi { font-size: 14px; color: var(--doux); }
.page { flex: 1; padding-block: 8px 32px; }
.pied { padding-block: 16px 24px; text-align: center; font-size: 14px; }
.pied a { color: var(--doux); }

/* ---------- écrans */
.ecran { display: flex; flex-direction: column; gap: 24px; }
.centre { min-height: 50vh; align-items: center; justify-content: center; text-align: center; }
.accroche { display: flex; flex-direction: column; gap: 12px; max-width: 640px; padding-top: 16px; }
.chapo { font-size: 18px; color: var(--doux); max-width: 56ch; }
.sur-titre { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--basilic); }
.discret { color: var(--doux); }
.petit-texte { font-size: 13px; }

.carte { background: var(--surface); border: 1px solid var(--trait); border-radius: var(--r); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.etroite { max-width: 520px; width: 100%; }
.carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.compteur { font-family: var(--f-titre); font-weight: 800; font-size: 22px; font-variant-numeric: tabular-nums; color: var(--basilic); }

label { font-weight: 700; font-size: 15px; }
.ligne { display: flex; gap: 8px; }
.ligne input { flex: 1; min-width: 0; }
input, textarea {
  background: var(--fond); border: 1.5px solid var(--trait); border-radius: 10px;
  padding: 11px 14px; font-size: 16px; width: 100%;
}
input:focus, textarea:focus { border-color: var(--basilic); outline: none; }

.btn {
  background: var(--basilic); color: var(--basilic-encre); border: 0; border-radius: 10px;
  padding: 11px 18px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; transform: none; }
.btn.petit { padding: 8px 12px; font-size: 14px; }
.btn.secondaire { background: var(--surface-2); color: var(--texte); }
.btn.danger { background: var(--tomate); color: #fff; }
.lien { background: none; border: 0; color: var(--doux); text-decoration: underline; cursor: pointer; padding: 8px 0; align-self: flex-start; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.erreur { background: var(--erreur-fond); color: var(--texte); border-left: 4px solid var(--tomate); padding: 10px 12px; border-radius: 8px; font-size: 15px; }
.succes { background: var(--succes-fond); border-left: 4px solid var(--basilic); padding: 10px 12px; border-radius: 8px; font-size: 15px; }
.confirmation { background: var(--erreur-fond); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }

/* ---------- étapes de l'accueil (vraie séquence, d'où la numérotation) */
.etapes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; max-width: 760px; counter-reset: etape; }
.etapes li { counter-increment: etape; display: flex; flex-direction: column; gap: 4px; padding: 14px 0 0; border-top: 2px solid var(--trait); }
.etapes li::before { content: counter(etape); font-family: var(--f-titre); font-weight: 800; font-size: 28px; line-height: 1; }
.etapes li:nth-child(1)::before { color: var(--basilic); }
.etapes li:nth-child(2)::before { color: var(--moutarde); }
.etapes li:nth-child(3)::before { color: var(--tomate); }
.etapes span { color: var(--doux); font-size: 15px; }

/* ---------- listes de noms */
.noms { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.noms li { display: inline-flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 999px; padding: 6px 12px 6px 6px; font-weight: 700; }
.noms li.moi-meme { outline: 2px solid var(--basilic); }
.noms li .en-attente { font-weight: 400; font-size: 13px; color: var(--doux); }
.rond { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff; flex: none; }
.gerer li { padding-right: 6px; }
.gerer .retirer { background: none; border: 0; color: var(--doux); cursor: pointer; font-size: 13px; padding: 4px 8px; border-radius: 999px; }
.gerer .retirer:hover { color: var(--tomate); }
.gerer .retirer.armer { background: var(--tomate); color: #fff; }

/* ---------- trio */
.trio-tete { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; }
.trio-membres { font-size: clamp(28px, 6vw, 44px); }
.trio-membres .sep { color: var(--doux); font-weight: 500; }
.trio-membres .toi { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 5px; text-decoration-color: var(--moutarde); }
.statut { font-size: 14px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); color: var(--doux); white-space: nowrap; }
.statut.partiel { background: color-mix(in srgb, var(--moutarde) 22%, var(--surface)); color: var(--texte); }
.statut.valide { background: var(--basilic); color: var(--basilic-encre); }

.trio-grille { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 820px) { .trio-grille { grid-template-columns: minmax(0, 1fr); } }

.plan { gap: 18px; }
.champ-plan { display: flex; flex-direction: column; gap: 8px; }
.idees { display: flex; flex-wrap: wrap; gap: 6px; }
.idee { background: transparent; border: 1px dashed var(--trait); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--doux); cursor: pointer; }
.idee:hover { border-style: solid; color: var(--texte); border-color: var(--basilic); }
.validation { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--trait); }
.votes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.votes li { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.votes .etat { margin-left: auto; font-size: 13px; color: var(--doux); }
.votes li.ok .etat { color: var(--basilic); font-weight: 700; }

/* ---------- chat */
.chat { padding: 0; gap: 0; height: min(72dvh, 680px); }
.chat .carte-tete { padding: 16px 20px; border-bottom: 1px solid var(--trait); }
.fil { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; overscroll-behavior: contain; }
.fil-vide { margin: auto; text-align: center; color: var(--doux); max-width: 32ch; }
.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 82%; }
.msg.moi { align-self: flex-end; align-items: flex-end; }
.msg.nouveau-groupe { margin-top: 10px; }
.msg .auteur { font-size: 13px; font-weight: 700; margin: 0 4px 2px; }
.msg .bulle { background: var(--bulle); padding: 8px 12px; border-radius: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.moi .bulle { background: var(--bulle-moi); color: var(--bulle-moi-texte); }
.msg .heure { font-size: 11px; color: var(--doux); margin: 2px 6px 0; font-variant-numeric: tabular-nums; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--trait); align-items: flex-end; }
.composer textarea { resize: none; max-height: 140px; line-height: 1.4; }
.chat .erreur { margin: 0 12px 12px; }

/* ---------- organisateur */
.trios-apercu { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.trio-bloc { border: 1px solid var(--trait); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.trio-bloc .tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.trio-bloc h3 { margin: 0; font-family: var(--f-titre); font-size: 18px; }
.trio-bloc dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; }
.trio-bloc dt { color: var(--doux); }
.trio-bloc dd { margin: 0; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
