/* Roidle — feuille de style (identité Omnia amplecti, variante fond noir) */
:root {
  --bg: #14110f;        /* fond noir chaud */
  --bg2: #1b1714;
  --carte: #211c18;     /* cartes / panneaux */
  --carte2: #2a241f;
  --bordure: #392f27;
  --encre: #f4ede1;     /* titres (clairs) */
  --texte: #e7ddcd;     /* corps */
  --muet: #a99c8b;
  --or: #b89a5a;        /* or de la charte */
  --or-clair: #cdb06a;
  --or-fonce: #d8bd74;  /* texte/lien accentué, lisible sur fond noir */
  --ok: #3f7a45;        /* vert (exact) */
  --rouge: #b14a39;     /* rouge (direction) */
  --chev: #c39a36;      /* chevauchement (or soutenu) */
  --rayon: 12px;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
.pied { order: 1; }  /* pied de page toujours en dernier (body en flex) */
body {
  margin: 0;
  font-family: var(--sans);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 82% 88%, rgba(184, 154, 90, 0.08), transparent 50%),
    radial-gradient(1200px 700px at 50% -15%, #2a221b, var(--bg));
  background-attachment: fixed;
  color: var(--texte);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}

/* Nav de retour (logo du site) */
.rd-nav { width: 100%; max-width: 720px; padding: 1rem 0.9rem 0; display: flex; align-items: center; }
.rd-logo {
  font-family: var(--serif); font-style: normal; font-weight: 500; font-size: 1.35rem;
  color: var(--encre); text-decoration: none; letter-spacing: 0.01em; transition: color 0.15s;
}
.rd-logo::before { content: none; }
.rd-logo:hover { color: var(--or-clair); }

/* En-tête */
.entete { width: 100%; max-width: 720px; padding: 0.6rem 0.9rem 0.2rem; text-align: left; }
.entete h1 {
  margin: 0.5rem 0 0.1rem;
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 3.6rem); line-height: 1.03; letter-spacing: 0.01em;
  color: var(--encre);
}
.accroche {
  margin: 0.1rem 0 0.7rem; color: var(--muet);
  font-family: var(--serif); font-style: italic; font-size: 1.25rem;
}
.lien-aide {
  font-family: var(--sans); display: inline-block; text-decoration: none;
  background: var(--carte); border: 1px solid var(--bordure); color: var(--texte);
  padding: 0.3rem 0.8rem; border-radius: 999px; cursor: pointer; font-size: 0.8rem;
  margin-right: 0.35rem;
}
.lien-aide:hover { color: var(--encre); border-color: var(--or); }
.filet {
  height: 1px; margin: 0.9rem 0 0.2rem;
  background: linear-gradient(90deg, transparent, var(--or-clair) 50%, transparent);
  opacity: 0.7;
}

main { width: 100%; max-width: 720px; padding: 0.6rem 0.9rem 2rem; }

/* Écran de choix du mode */
.mode-select { text-align: center; padding: 1.6rem 0.5rem; }
.mode-select h2 { font-family: var(--serif); color: var(--encre); margin: 0 0 1.2rem; font-size: 1.9rem; font-weight: 600; }
.modes { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.mode-carte {
  flex: 1 1 240px; max-width: 300px; text-align: left; cursor: pointer;
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
  padding: 1.1rem 1.2rem; color: var(--texte);
  display: flex; flex-direction: column; gap: 0.4rem;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.mode-carte:hover { border-color: var(--or); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4); }
.mode-carte.dernier { border-color: var(--or); }
.mode-titre { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; color: var(--or-clair); }
.mode-desc { font-size: 0.88rem; color: var(--muet); }
.mode-note { color: var(--muet); font-size: 0.82rem; margin-top: 1.2rem; }

/* Barre de mode au-dessus du jeu */
.mode-barre { text-align: center; color: var(--muet); font-size: 0.85rem; margin: 0.2rem 0 0.7rem; }
.mode-barre strong { color: var(--or-clair); }
.mode-barre a { color: var(--muet); text-decoration: underline; }
.mode-barre a:hover { color: var(--or-clair); }

/* Recherche */
.zone-recherche { position: relative; }
#recherche {
  width: 100%; padding: 0.85rem 1rem; font-size: 1rem; font-family: var(--sans);
  background: var(--carte); border: 1px solid var(--bordure);
  border-radius: var(--rayon); color: var(--encre); outline: none;
}
#recherche::placeholder { color: #877c6c; }
#recherche:focus { border-color: var(--or); box-shadow: 0 0 0 3px rgba(184, 154, 90, 0.18); }
#recherche:disabled { opacity: 0.55; }

.suggestions {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 0.3rem; list-style: none;
  background: var(--carte2); border: 1px solid var(--bordure); border-radius: var(--rayon);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5); max-height: 320px; overflow-y: auto;
}
.suggestions li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.55rem 0.7rem; border-radius: 7px; cursor: pointer;
}
.suggestions li span { color: var(--muet); font-size: 0.85rem; }
.suggestions li:hover, .suggestions li.actif { background: var(--carte); }
.suggestions li.actif { outline: 1px solid var(--or); }

.compteur { text-align: center; color: var(--muet); font-size: 0.85rem; margin: 0.6rem 0; }
.compteur span { color: var(--or-clair); font-weight: 600; }

/* Message flash */
.message {
  text-align: center; min-height: 1.4rem; color: var(--or-clair);
  font-size: 0.9rem; opacity: 0; transition: opacity 0.2s; margin-bottom: 0.3rem;
}
.message.visible { opacity: 1; }

/* Grille */
.entetes-colonnes, .ligne {
  display: grid;
  grid-template-columns: 2fr 0.8fr 1.2fr 1.2fr 1.6fr;
  gap: 6px;
}
.entetes-colonnes {
  margin: 0.2rem 0 0.4rem; padding: 0 2px;
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--or);
}
.entetes-colonnes div { text-align: center; }
.grille { display: flex; flex-direction: column; gap: 6px; }

.ligne { min-height: 60px; }
.cellule {
  background: var(--carte); border: 1px solid var(--bordure); border-radius: 8px;
  padding: 6px 4px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; text-align: center;
  animation: apparition 0.25s ease both;
}
.ligne.vide .cellule { background: var(--bg2); border-style: dashed; opacity: 0.55; }
.cellule.tete { background: var(--carte2); }
.cellule .ct { font-size: 0.82rem; font-weight: 600; line-height: 1.15; color: var(--encre); }
.cellule .cs { font-size: 0.72rem; color: var(--muet); }
.ligne.gagnee .cellule { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok) inset; }

.badge {
  display: inline-block; padding: 2px 7px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: var(--ok); color: #f3fbf1; }
.badge.dir { background: var(--rouge); color: #fdf0ec; }
.badge.chev { background: var(--chev); color: #2a1f02; }

@keyframes apparition { from { transform: translateY(-4px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Fin de partie */
.fin {
  margin-top: 1.2rem; padding: 1.3rem; text-align: center;
  background: var(--carte); border: 1px solid var(--bordure); border-radius: var(--rayon);
}
.fin h2 { font-family: var(--serif); margin: 0 0 0.5rem; color: var(--or-clair); font-size: 1.9rem; font-weight: 600; }
.fin .reponse { color: var(--texte); }
.fin .anecdote {
  font-family: var(--serif); font-style: italic; font-size: 1.08rem;
  color: var(--or-clair); margin: 0.5rem auto 0; max-width: 46ch; line-height: 1.4;
}
.fin .prochain { color: var(--muet); font-size: 0.85rem; margin-top: 0.8rem; }

.bouton {
  display: inline-block; text-decoration: none; text-align: center; font-family: var(--sans);
  background: linear-gradient(180deg, var(--or-clair), var(--or));
  color: #2c2102; border: none; padding: 0.7rem 1.4rem; border-radius: 999px;
  font-size: 0.9rem; font-weight: 600; cursor: pointer; margin-top: 0.4rem;
}
.bouton:hover { filter: brightness(1.06); }

/* Grille de partage (résumé visuel des manches) */
.partage-grille {
  display: inline-flex; flex-direction: column; gap: 4px;
  margin: 0.8rem auto 0.4rem; padding: 0.4rem; border-radius: 8px;
}
.pg-row { display: flex; gap: 4px; justify-content: center; }
.pg {
  width: 30px; height: 30px; border-radius: 5px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1rem; color: #fff;
}
.pg-ok { background: var(--ok); }
.pg-dir { background: var(--rouge); }
.pg-close { background: var(--chev); color: #2a1f02; }

/* Statistiques de la communauté */
.stats-comm-zone { margin: 0.6rem 0 0.2rem; min-height: 1.5rem; }
.stats-chargement, .stats-indispo { color: var(--muet); font-size: 0.85rem; }
.stats-comm h3 { font-family: var(--serif); margin: 0.6rem 0 0.3rem; color: var(--or-clair); font-size: 1.4rem; font-weight: 600; }
.stats-resume { margin: 0.2rem 0; font-size: 0.92rem; }
.stats-resume strong { color: var(--or-clair); }
.stats-joues { color: var(--muet); font-size: 0.82rem; }
.stats-sous {
  margin: 0.7rem 0 0.4rem; color: var(--muet);
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em;
}
.stats-bars { display: flex; flex-direction: column; gap: 5px; max-width: 360px; margin: 0 auto; }
.stat-bar { display: flex; align-items: center; gap: 8px; }
.sb-label { width: 1ch; color: var(--muet); font-size: 0.85rem; font-weight: 600; }
.sb-track { flex: 1; background: var(--bg2); border-radius: 5px; height: 18px; overflow: hidden; }
.sb-fill {
  height: 100%; background: linear-gradient(90deg, var(--or), var(--or-clair));
  border-radius: 5px; min-width: 2px; transition: width 0.5s ease;
}
.sb-val { width: 3.2ch; text-align: right; color: var(--muet); font-size: 0.8rem; }

/* Boutons de partage */
.partage-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 0.8rem;
}
.partage-actions .bouton { margin-top: 0; }
.bouton-tw { background: #1d1d1f; color: #fff; }
.bouton-bsky { background: linear-gradient(180deg, #1185fe, #0a6edb); color: #fff; }
.autre-mode-ligne { margin: 0.9rem 0 0; }
.fin-modes { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 0.9rem; }
.fin-modes .bouton { margin-top: 0; }
.bouton-mode { background: transparent; border: 1px solid var(--or); color: var(--or-clair); }
.bouton-mode:hover { filter: none; background: rgba(184, 154, 90, 0.12); }
.bouton-entrainement { background: transparent; border: 1px dashed var(--or); color: var(--or-clair); }
.bouton-entrainement:hover { filter: none; background: rgba(184, 154, 90, 0.12); }
.entrainement-note { color: var(--muet); font-size: 0.85rem; font-style: italic; margin: 0.2rem 0 0.4rem; }

/* Aide (dialog) */
dialog#aide {
  max-width: 460px; border: 1px solid var(--or); border-radius: var(--rayon);
  background: var(--carte); color: var(--texte); padding: 1.4rem; font-family: var(--sans);
}
dialog#aide::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog#aide h2 { font-family: var(--serif); margin-top: 0; color: var(--or-clair); font-weight: 600; }
dialog#aide ul { padding-left: 1.1rem; }
dialog#aide li { margin: 0.35rem 0; }

.pied { color: var(--muet); font-size: 1rem; padding: 1rem 0 2rem; font-family: var(--serif); font-style: italic; }

/* Responsive */
@media (max-width: 560px) {
  .entetes-colonnes, .ligne { grid-template-columns: 1.6fr 0.7fr 1fr 1fr 1.5fr; gap: 4px; }
  .cellule .ct { font-size: 0.74rem; }
  .badge { font-size: 0.66rem; padding: 2px 5px; }
}
