:root {
  color-scheme: dark;
  --terre: #1d1510;
  --terre-2: #2a1f18;
  --terre-3: #3a2b21;
  --trait: #54402f;
  --creme: #f4eadb;
  --creme-2: #c5b4a0;
  --ambre: #e8a33d;
  --ambre-fonce: #2a1a05;
  --mousse: #8fbf7f;
  --rouge: #e8765f;
  --rayon: 14px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--terre);
  color: var(--creme);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

h1, h2, p { margin: 0; }
h1 { font-size: 42px; line-height: 1.05; letter-spacing: -0.02em; font-weight: 800; }
h2 { font-size: 24px; line-height: 1.2; font-weight: 750; }
.discret { color: var(--creme-2); font-size: 15px; }
.etiquette {
  color: var(--creme-2);
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pile { display: flex; flex-direction: column; gap: 10px; }
.ligne { display: flex; align-items: center; gap: 10px; }
.pousse { margin-top: auto; }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* Accueil */
.titre { display: flex; align-items: center; gap: 14px; padding-top: 18px; }
.titre img { width: 72px; height: 72px; flex: none; }

.carte {
  background: var(--terre-2);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 16px;
}

label { display: block; font-weight: 650; margin-bottom: 6px; }

input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px;
  color: var(--creme);
  background: var(--terre);
  border: 1px solid var(--trait);
  border-radius: 10px;
  font: inherit;
}

input:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid var(--ambre);
  outline-offset: 2px;
}

input.code {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-weight: 800;
  text-align: center;
}
input.code::placeholder { letter-spacing: 0.3em; font-weight: 500; }

button {
  min-height: 50px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  color: var(--creme);
  background: var(--terre-3);
  cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.5; cursor: default; transform: none; }
button.principal { background: var(--ambre); color: var(--ambre-fonce); }
button.lien {
  min-height: 44px;
  background: none;
  color: var(--creme-2);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.danger { color: var(--rouge); }
button.large { width: 100%; }
button.petit { min-height: 44px; padding: 6px 12px; font-size: 15px; }

details summary { cursor: pointer; font-weight: 650; min-height: 32px; }
details ol { margin: 10px 0 0; padding-left: 22px; color: var(--creme-2); }
details li { margin-bottom: 6px; }

/* Salon */
.code-salon {
  font-size: 54px;
  font-weight: 850;
  letter-spacing: 0.16em;
  line-height: 1;
  color: var(--ambre);
  font-variant-numeric: tabular-nums;
  margin-right: -0.16em;
}
.bloc-code { text-align: center; display: flex; flex-direction: column; gap: 8px; align-items: center; }

.joueurs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.joueurs li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 0;
  border-bottom: 1px solid var(--terre-3);
}
.joueurs li:last-child { border-bottom: 0; }
.joueurs .nom { flex: 1 1 35%; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.joueurs li { flex-wrap: wrap; }
.score {
  min-width: 42px;
  text-align: right;
  font-weight: 750;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.marque.gain { color: var(--mousse); font-weight: 750; }
.hors-jeu .nom { color: var(--creme-2); text-decoration: line-through; }
.marque { font-size: 13px; color: var(--creme-2); white-space: nowrap; }
.marque.alerte { color: var(--rouge); }
.marque.taupe { color: var(--ambre); font-weight: 700; }
.point {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--mousse);
}
.point.absent { background: var(--rouge); }

.choix { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choix button[aria-pressed="true"] { background: var(--ambre); color: var(--ambre-fonce); }

/* Mot */
.mot {
  width: 100%;
  min-height: 150px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--terre-2);
  border: 2px dashed var(--trait);
  border-radius: var(--rayon);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.mot.visible { border-style: solid; border-color: var(--ambre); }
.mot .valeur { font-size: 34px; line-height: 1.15; font-weight: 800; overflow-wrap: anywhere; color: var(--ambre); }
.mot .indice { color: var(--creme-2); font-size: 15px; font-weight: 500; }

/* Ordre de parole */
.ordre { margin: 0; padding: 0; list-style: none; counter-reset: rang; }
.ordre li {
  counter-increment: rang;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.ordre li::before {
  content: counter(rang);
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--ambre);
  background: var(--terre-3);
}

/* Vote */
.vote-liste { display: flex; flex-direction: column; gap: 8px; }
.vote-liste button { text-align: left; overflow-wrap: anywhere; border-color: var(--trait); background: var(--terre-2); }
.vote-liste button[aria-pressed="true"] { background: var(--ambre); color: var(--ambre-fonce); border-color: var(--ambre); }
.compteur { font-size: 15px; color: var(--creme-2); font-variant-numeric: tabular-nums; }

/* Résultats */
.verdict { text-align: center; padding: 26px 16px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.verdict .grand { font-size: 32px; line-height: 1.15; font-weight: 850; overflow-wrap: anywhere; }
.verdict.taupes .grand { color: var(--ambre); }
.verdict.civils .grand { color: var(--mousse); }
.mots-fin { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mots-fin > div { background: var(--terre-3); border-radius: 10px; padding: 12px; overflow-wrap: anywhere; }
.mots-fin strong { display: block; font-size: 20px; line-height: 1.2; }

/* Messages */
.bandeau {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 16px;
  text-align: center;
  font-size: 15px;
  font-weight: 650;
  background: var(--ambre);
  color: var(--ambre-fonce);
}
.message {
  position: fixed;
  z-index: 3;
  left: 16px;
  right: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  max-width: 448px;
  margin: 0 auto;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--creme);
  color: #3a1d12;
  font-weight: 650;
  box-shadow: 0 8px 28px rgb(0 0 0 / 0.45);
}
.noscript { padding: 24px; text-align: center; }
[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  button:active { transform: none; }
}
