:root {
  --rouge: #d42a1c; --rouge-fonce: #a81f14; --ardoise: #2f3640; --or: #e0a526;
  --fond: #fbf6ee; --carte: #ffffff; --ligne: #eadfce; --doux: #7a7066;
  --vert: #1f9d55; --gris: #b9b0a5;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fond); color: var(--ardoise);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
main { max-width: 760px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px 40px; }
h1, h2, h3 { margin: 0 0 .4em; }
button { font: inherit; border: 0; border-radius: 14px; padding: 14px 18px; cursor: pointer;
  background: var(--rouge); color: #fff; font-weight: 700; }
button:active { transform: scale(.98); }
button.second { background: var(--carte); color: var(--ardoise); border: 2px solid var(--ligne); }
button.petit { padding: 8px 12px; font-size: 14px; border-radius: 10px; }
button:disabled { opacity: .45; }
input { font: inherit; font-size: 16px; width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--ligne); background: #fff; color: var(--ardoise); }
input:focus { outline: none; border-color: var(--rouge); }
.carte { background: var(--carte); border: 1px solid var(--ligne); border-radius: 18px; padding: 18px; margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(47,54,64,.05); }
.pile { display: grid; gap: 10px; }
.rangee { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.doux { color: var(--doux); font-size: 14px; }
.centre { text-align: center; }

/* Accueil */
.logo { display: flex; flex-direction: column; align-items: center; margin: 18px 0 22px; }
.soleil { width: 92px; height: 92px; border-radius: 50%; background: var(--rouge); display: grid; place-items: center;
  color: #fff; font-size: 40px; font-weight: 800; box-shadow: 0 8px 24px rgba(212,42,28,.3); }
.logo h1 { font-size: 40px; letter-spacing: .08em; margin-top: 12px; }
.regles { font-size: 15px; }
.regles li { margin: 4px 0; }
.choix { display: flex; gap: 8px; }
.choix button { flex: 1; }
.choix button.actif { background: var(--ardoise); color: #fff; border-color: var(--ardoise); }

/* Salle */
.code { font-size: 46px; font-weight: 800; letter-spacing: .25em; color: var(--rouge); text-align: center; }
.joueurs { display: flex; flex-wrap: wrap; gap: 8px; }
.puce { background: var(--fond); border: 1px solid var(--ligne); border-radius: 999px; padding: 6px 12px; font-weight: 600; }
.puce.hote::after { content: " 👑"; }

/* Partie */
.entete { position: sticky; top: 0; z-index: 5; background: var(--fond); padding: 8px 0 10px; display: flex;
  justify-content: space-between; align-items: center; gap: 10px; }
.chrono { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chrono.urgent { color: var(--rouge); animation: pouls 1s infinite; }
@keyframes pouls { 50% { opacity: .5; } }
.grille { display: grid; grid-template-columns: 44px repeat(5, 1fr); gap: 4px; margin-bottom: 14px; }
.grille .tete { font-size: 11px; font-weight: 700; text-align: center; line-height: 1.15; padding: 4px 2px;
  display: flex; align-items: flex-end; justify-content: center; hyphens: auto; word-break: break-word; }
.grille .lettre { background: var(--rouge); color: #fff; border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 20px; }
.grille .case { min-height: 44px; border-radius: 10px; background: #fff; border: 2px solid var(--ligne);
  font-size: 11px; padding: 3px; display: flex; align-items: center; justify-content: center; text-align: center;
  cursor: pointer; overflow: hidden; overflow-wrap: anywhere; hyphens: auto; line-height: 1.1; }
.grille .case.pleine { background: #fff4e0; border-color: var(--or); font-weight: 600; }
.grille .case.active { border-color: var(--rouge); box-shadow: 0 0 0 2px var(--rouge); }
.grille .case.bon { background: #e3f6ea; border-color: var(--vert); }
.grille .case.unique { background: #fff1c9; border-color: var(--or); }
.grille .case.faux { background: #f4f1ec; border-color: var(--ligne); color: var(--gris); text-decoration: line-through; }
.saisie .titre { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.saisie .grosse { width: 56px; height: 56px; border-radius: 50%; background: var(--rouge); color: #fff; display: grid;
  place-items: center; font-size: 28px; font-weight: 800; flex: none; }
.champ label { display: block; font-size: 13px; font-weight: 700; margin: 0 0 3px 2px; }
.nav { display: flex; gap: 8px; margin-top: 12px; }
.nav button { flex: 1; }

/* Résultats */
.score { font-size: 54px; font-weight: 800; color: var(--rouge); text-align: center; line-height: 1; }
.classement { list-style: none; padding: 0; margin: 0; }
.classement li { display: flex; justify-content: space-between; padding: 10px 4px; border-bottom: 1px solid var(--ligne); font-weight: 600; }
.classement li:first-child { font-size: 19px; }
.legende { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 10px; }
.legende span::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 5px; vertical-align: -1px; }
.legende .l-bon::before { background: #e3f6ea; border: 2px solid var(--vert); }
.legende .l-unique::before { background: #fff1c9; border: 2px solid var(--or); }
.legende .l-faux::before { background: #f4f1ec; border: 2px solid var(--ligne); }
.erreur { background: #fde8e6; color: var(--rouge-fonce); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-weight: 600; }
footer { text-align: center; color: var(--doux); font-size: 12px; margin-top: 30px; }
