/* =============================================================================
   Feuille commune aux deux instances. Tout ce qui change d'une app à l'autre
   (couleurs, rayons d'ombre) vit dans theme.css, généré par build.py.
   Aucune dépendance externe : une PWA emballée en TWA doit pouvoir s'afficher
   hors ligne, donc rien ne peut venir d'un CDN.
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--creme);
  color: var(--encre);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button { font: inherit; color: inherit; }

/* ── En-tête ─────────────────────────────────────────────────────────────── */

.entete {
  background: linear-gradient(135deg, var(--vif), var(--fonce));
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 16px) 18px 0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.entete__haut { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.marque { margin: 0; font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; }
.accroche { margin: 4px 0 12px; font-size: .87rem; opacity: .9; }

.rond {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
}
.rond:active { background: rgba(255, 255, 255, .3); }

.onglets { display: flex; gap: 4px; }
.onglet {
  flex: 1;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  padding: 10px 6px;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.onglet.est-actif { color: #fff; border-bottom-color: #fff; }

/* ── Fil ─────────────────────────────────────────────────────────────────── */

.fil { padding: 16px 14px calc(env(safe-area-inset-bottom) + 96px); max-width: 640px; margin: 0 auto; }

.etat { text-align: center; color: var(--encre-doux); padding: 32px 12px; font-size: .93rem; }
.etat button { margin-top: 12px; }

.carte {
  background: #fff;
  border-radius: 18px;
  padding: 16px 16px 8px;
  margin-bottom: 14px;
  box-shadow: 0 4px 14px var(--ombre);
}
.carte__haut { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.carte__pseudo { font-weight: 700; font-size: .9rem; }
.carte__cat {
  display: inline-block;
  background: var(--creme);
  color: var(--encre-doux);
  border-radius: 99px;
  padding: 3px 9px;
  font-size: .71rem;
  margin-left: 6px;
  white-space: nowrap;
}
.carte__texte { margin: 10px 0 12px; color: var(--encre-texte); white-space: pre-line; }

.menu {
  flex: 0 0 auto;
  border: 0; background: transparent;
  color: var(--encre-doux);
  font-size: 1.15rem; line-height: 1;
  padding: 2px 6px; cursor: pointer;
}

/* Réactions */
.reactions { display: flex; gap: 8px; border-top: 1px solid var(--filet); padding-top: 8px; }
.reac {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 9px 4px;
  font-size: .86rem;
  font-weight: 600;
  color: var(--encre-doux);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}
.reac:active { background: var(--creme); }
.reac[aria-pressed="true"] { background: var(--pale); color: var(--fonce); }
.reac__n { font-variant-numeric: tabular-nums; opacity: .85; }

/* ── Bouton flottant ─────────────────────────────────────────────────────── */

.flottant {
  position: fixed;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  z-index: 30;
  border: 0;
  border-radius: 99px;
  padding: 14px 22px;
  background: linear-gradient(135deg, var(--vif), var(--fonce));
  color: #fff;
  font-weight: 800;
  font-size: .95rem;
  box-shadow: 0 8px 22px var(--ombre-forte);
  cursor: pointer;
}
.flottant:active { transform: translateY(1px); }

/* ── Feuilles ────────────────────────────────────────────────────────────── */

.feuille {
  border: 0;
  padding: 0;
  width: 100%;
  max-width: 640px;
  max-height: 92vh;
  margin: auto auto 0;
  border-radius: 22px 22px 0 0;
  background: var(--creme);
  color: var(--encre);
}
.feuille::backdrop { background: rgba(0, 0, 0, .45); }

.feuille__barre {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px;
  background: var(--creme);
  border-bottom: 1px solid var(--filet);
}
.feuille__barre strong { font-size: .97rem; }
.feuille__corps { padding: 16px 16px calc(env(safe-area-inset-bottom) + 28px); overflow-y: auto; }

.lien { border: 0; background: transparent; color: var(--fonce); font-size: .92rem; cursor: pointer; padding: 4px; }
.lien--fort { font-weight: 800; }
.lien:disabled { opacity: .38; cursor: default; }

.etiquette { display: block; font-size: .8rem; font-weight: 700; color: var(--encre-doux); margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .05em; }

textarea, select {
  width: 100%;
  border: 1px solid var(--filet);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  color: var(--encre);
  font: inherit;
  resize: vertical;
}
textarea:focus, select:focus { outline: 2px solid var(--vif); outline-offset: 1px; }

.sous-champ { display: flex; justify-content: space-between; gap: 10px; font-size: .78rem; color: var(--encre-doux); margin-top: 6px; }

.pseudo-ligne { font-size: .9rem; margin: 18px 0 0; color: var(--encre-doux); }

/* Case à cocher : un vrai bouton dont TOUTE la ligne est cliquable. Un <input
   type=checkbox> a une cible tactile minuscule, et c'est la convention iOS. */
.case {
  display: flex; gap: 10px; align-items: flex-start;
  width: 100%; text-align: left;
  margin-top: 18px; padding: 12px;
  border: 1px solid var(--filet); border-radius: 14px;
  background: #fff; cursor: pointer;
}
.case__boite {
  flex: 0 0 auto; width: 22px; height: 22px; margin-top: 1px;
  border: 2px solid var(--encre-doux); border-radius: 6px;
}
.case[aria-pressed="true"] .case__boite {
  background: var(--vif); border-color: var(--vif);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  background-size: 16px; background-position: center; background-repeat: no-repeat;
}
.case__texte { font-size: .87rem; line-height: 1.45; }

.bloc { font-size: .92rem; margin: 0 0 14px; }
.bloc--doux { color: var(--encre-doux); font-size: .86rem; }
.titre-2 { font-size: .95rem; margin: 22px 0 8px; }
.regles { margin: 0 0 14px; padding-left: 20px; font-size: .88rem; }
.regles li { margin-bottom: 7px; }

.danger {
  width: 100%; margin-top: 8px;
  border: 1px solid #E5B4B4; border-radius: 14px;
  background: #fff; color: #B3261E;
  padding: 13px; font-weight: 700; cursor: pointer;
}
.pied-app { text-align: center; font-size: .8rem; color: var(--encre-doux); margin: 24px 0 0; }
.pied-app a { color: var(--encre-doux); margin: 0 5px; }

/* ── Toast ───────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%; transform: translate(-50%, 20px);
  bottom: calc(env(safe-area-inset-bottom) + 92px);
  z-index: 60;
  max-width: 88vw;
  background: var(--encre); color: #fff;
  padding: 12px 18px; border-radius: 14px;
  font-size: .89rem; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s;
}
.toast.est-visible { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .flottant:active { transform: none; }
}
