/* Tondestin — baraque foraine, nuit, ampoules, et un ticket imprimé.
   Les couleurs viennent de la signalétique forain peinte à la main :
   rouge de manège, jaune d'ampoule, crème d'affiche vieillie. */

@import url('https://fonts.googleapis.com/css2?family=Rye&family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,800;1,9..144,400;1,9..144,600&display=swap');

:root {
  --encre: #17102e;
  --encre-clair: #221741;
  --velours: #2a1a4a;
  --rouge: #d62839;
  --rouge-fonce: #a81b29;
  --ampoule: #ffc93c;
  --creme: #f4e7ce;
  --creme-vif: #fff6e6;
  --jade: #2e9887;
  --encre-doux: rgba(244, 231, 206, 0.66);

  --affiche: 'Rye', 'Rockwell', Georgia, serif;
  --texte: 'Fraunces', Georgia, 'Times New Roman', serif;

  --rayon-panneau: 6px;
  --largeur: 62rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--encre);
  color: var(--creme);
  font-family: var(--texte);
  font-size: 1.0625rem;
  line-height: 1.62;
  font-optical-sizing: auto;
}

a { color: var(--ampoule); text-underline-offset: 3px; }
a:hover { color: var(--creme-vif); }

:focus-visible {
  outline: 3px solid var(--ampoule);
  outline-offset: 3px;
  border-radius: 2px;
}

.pour-lecteurs {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* ── Guirlande d'ampoules ─────────────────────────────────────────────────── */

.guirlande {
  display: flex;
  justify-content: center;
  gap: clamp(0.7rem, 3vw, 1.6rem);
  padding: 0.9rem 0 0;
  border-top: 3px solid var(--rouge);
}

.guirlande span {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--ampoule);
  box-shadow: 0 0 9px 2px rgba(255, 201, 60, 0.7);
}

.guirlande span:nth-child(3n) { background: var(--creme-vif); box-shadow: 0 0 9px 2px rgba(255, 246, 230, 0.55); }
.guirlande span:nth-child(4n) { animation: clignote 3.4s infinite ease-in-out; }
.guirlande span:nth-child(7n) { animation: clignote 4.9s infinite ease-in-out 0.8s; }

@keyframes clignote {
  0%, 44%, 56%, 100% { opacity: 1; }
  50% { opacity: 0.22; }
}

/* ── Structure ────────────────────────────────────────────────────────────── */

.page {
  width: min(100% - 2.5rem, var(--largeur));
  margin-inline: auto;
}

.barre {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.4rem 0 2rem;
}

.enseigne {
  font-family: var(--affiche);
  font-size: 1.5rem;
  color: var(--ampoule);
  text-decoration: none;
  letter-spacing: 0.01em;
  text-shadow: 2px 2px 0 var(--rouge-fonce);
}
.enseigne:hover { color: var(--creme-vif); }

.liens-barre {
  display: flex;
  gap: 1.3rem;
  font-size: 0.95rem;
}

footer {
  margin: 5rem 0 0;
  padding: 2rem 0 3rem;
  border-top: 1px solid rgba(244, 231, 206, 0.16);
  color: var(--encre-doux);
  font-size: 0.9rem;
}
footer p { margin: 0.35rem 0; }

/* ── Accueil ──────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  text-align: center;
  padding: 2.5rem 0 3rem;
}

.hero::before {
  content: '';
  position: absolute;
  inset: -6rem -30% auto;
  height: 34rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 201, 60, 0.15), transparent 62%);
  pointer-events: none;
  z-index: -1;
}

.titre-foire {
  font-family: var(--affiche);
  font-size: clamp(2.9rem, 12vw, 6.4rem);
  line-height: 0.92;
  margin: 0;
  color: var(--creme-vif);
  text-shadow:
    3px 3px 0 var(--rouge),
    6px 6px 0 rgba(0, 0, 0, 0.35);
}

.sous-enseigne {
  font-size: clamp(1.02rem, 2.6vw, 1.2rem);
  font-style: italic;
  color: var(--ampoule);
  margin: 1.1rem auto 0;
  max-width: 34ch;
}

.baratin {
  max-width: 52ch;
  margin: 1.2rem auto 0;
  color: var(--encre-doux);
}

/* ── Panneau de la machine ────────────────────────────────────────────────── */

.machine {
  max-width: 34rem;
  min-width: 0;
  margin: 2.6rem auto 0;
  padding: 1.9rem 1.7rem 1.7rem;
  background: linear-gradient(180deg, var(--velours), var(--encre-clair));
  border: 2px solid var(--ampoule);
  border-radius: var(--rayon-panneau);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  text-align: left;
}

.machine h2 {
  font-family: var(--affiche);
  font-size: 1.22rem;
  margin: 0 0 1.3rem;
  color: var(--ampoule);
  font-weight: 400;
}

.champ { margin-bottom: 1.15rem; }

.champ label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.98rem;
}

.champ input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--encre);
  background: var(--creme-vif);
  border: 2px solid transparent;
  border-radius: 3px;
}
.champ input:hover { border-color: rgba(255, 201, 60, 0.5); }

.aide {
  margin: 0.4rem 0 0;
  font-size: 0.88rem;
  color: var(--encre-doux);
}

.bouton {
  display: inline-block;
  width: 100%;
  padding: 0.95rem 1.4rem;
  font-family: var(--texte);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--creme-vif);
  background: var(--rouge-fonce);
  border: 2px solid var(--rouge);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 5px 0 #6f101c;
  transition: transform 0.06s ease, box-shadow 0.06s ease;
}
.bouton:hover { background: var(--rouge); }
.bouton:active { transform: translateY(4px); box-shadow: 0 1px 0 #6f101c; }
.bouton[disabled] { opacity: 0.6; cursor: progress; }

.bouton-discret {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  font: inherit;
  font-weight: 600;
  color: var(--creme);
  background: transparent;
  border: 2px solid rgba(244, 231, 206, 0.4);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
}
.bouton-discret:hover { border-color: var(--ampoule); color: var(--ampoule); }

.erreur {
  margin: 1rem 0 0;
  padding: 0.7rem 0.9rem;
  background: rgba(214, 40, 57, 0.18);
  border-left: 4px solid var(--rouge);
  color: var(--creme-vif);
  font-size: 0.95rem;
}

.erreur:empty { display: none; }

/* ── Bandes d'information ─────────────────────────────────────────────────── */

.section { margin-top: 4.5rem; }

.section h2 {
  font-family: var(--affiche);
  font-weight: 400;
  font-size: 1.45rem;
  color: var(--ampoule);
  margin: 0 0 0.5rem;
}

.section > p {
  margin: 0 0 1.5rem;
  color: var(--encre-doux);
  max-width: 58ch;
}

.compteurs {
  display: flex;
  flex-wrap: wrap;
  gap: 2.4rem;
  margin-top: 3.2rem;
  justify-content: center;
}

.compteur strong {
  display: block;
  font-family: var(--affiche);
  font-size: 2.1rem;
  font-weight: 400;
  color: var(--creme-vif);
  line-height: 1.1;
}

.compteur span {
  font-size: 0.9rem;
  color: var(--encre-doux);
}

.grille-signes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 0.9rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.grille-signes li {
  padding: 0.85rem 1rem;
  background: var(--encre-clair);
  border: 1px solid rgba(244, 231, 206, 0.14);
  border-radius: var(--rayon-panneau);
}

.grille-signes b { display: block; font-weight: 600; }
.grille-signes small { color: var(--encre-doux); }

.liste-nue { list-style: none; padding: 0; margin: 0; }

.ligne-destin {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid rgba(244, 231, 206, 0.13);
}
.ligne-destin:last-child { border-bottom: 0; }
.ligne-destin .rang {
  font-family: var(--affiche);
  color: var(--ampoule);
  min-width: 2.1rem;
}
.ligne-destin .mesure { margin-left: auto; color: var(--encre-doux); font-size: 0.9rem; white-space: nowrap; }

/* ── Le ticket ────────────────────────────────────────────────────────────── */

.zone-ticket {
  background: var(--encre);
  padding: 1.5rem 0 0;
}

.ticket {
  position: relative;
  max-width: 40rem;
  margin: 0 auto;
  padding: 2.6rem clamp(1.3rem, 5vw, 2.6rem) 2.4rem;
  background: var(--creme);
  color: #2b2118;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* Les dents perforées : des demi-cercles couleur fond, posés à cheval. */
.ticket::before,
.ticket::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 16px;
  background-image: radial-gradient(circle at 12px 50%, var(--encre) 7.5px, transparent 8px);
  background-size: 24px 16px;
  background-repeat: repeat-x;
}
.ticket::before { top: -8px; }
.ticket::after { bottom: -8px; }

.ticket-impression { animation: impression 0.85s cubic-bezier(0.22, 0.8, 0.3, 1) both; }

@keyframes impression {
  from { clip-path: inset(0 0 100% 0); transform: translateY(-12px); }
  to { clip-path: inset(0 0 0 0); transform: none; }
}

.entete-ticket {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  color: #6a5a46;
  border-bottom: 2px solid #2b2118;
  padding-bottom: 0.6rem;
  margin-bottom: 1.8rem;
}

.signe-emoji { font-size: 3.4rem; line-height: 1; display: block; }

/* Colonne réservée au tampon, pour qu'un nom long ne passe pas dessous. */
@media (min-width: 34rem) {
  .entete-signe { padding-right: 10rem; }
}

.nom-signe {
  font-family: var(--affiche);
  font-weight: 400;
  font-size: clamp(1.9rem, 7vw, 2.9rem);
  line-height: 1.05;
  margin: 0.5rem 0 0.3rem;
  color: #2b2118;
}

.periode-signe { margin: 0; color: #6a5a46; font-size: 0.95rem; }

.devise {
  font-style: italic;
  font-size: 1.08rem;
  margin: 1.1rem 0 0;
  padding-left: 1rem;
  border-left: 3px solid var(--rouge);
}

.ticket p { max-width: 64ch; }

.perfo {
  border: 0;
  border-top: 2px dashed #c3b295;
  margin: 1.9rem 0;
}

.rubrique { margin-bottom: 1.5rem; }

.rubrique h3 {
  font-family: var(--texte);
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--rouge-fonce);
  margin: 0 0 0.25rem;
}

.rubrique p { margin: 0; }

.prophetie {
  font-size: 1.22rem;
  line-height: 1.5;
  margin: 0;
}

/* Tampon de rareté : le seul élément qui se permet d'être tapageur. */
.tampon {
  position: absolute;
  top: 5.4rem;
  right: clamp(1rem, 4vw, 2.2rem);
  transform: rotate(-11deg);
  padding: 0.45rem 0.8rem;
  border: 3px double currentColor;
  border-radius: 4px;
  font-family: var(--affiche);
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: center;
  max-width: 8.5rem;
  opacity: 0.88;
}
.tampon span { display: block; font-family: var(--texte); font-size: 0.68rem; letter-spacing: 0.04em; }

.jauges { display: grid; gap: 0.75rem; }

.jauge-ligne {
  display: grid;
  grid-template-columns: 11rem 1fr 2.6rem;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.94rem;
}

.jauge-piste {
  height: 10px;
  background: #ddcdae;
  border-radius: 5px;
  overflow: hidden;
}

.jauge-valeur {
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--rouge) 0 7px, var(--rouge-fonce) 7px 14px);
  border-radius: 5px;
}

.jauge-ligne b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.attributs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1.2rem 1.6rem;
  margin: 0;
}

.attributs dt {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  color: var(--rouge-fonce);
}
.attributs dd { margin: 0.1rem 0 0; }

.mission {
  margin-top: 0.5rem;
  padding: 1rem 1.1rem;
  background: #e9d9b8;
  border-left: 4px solid var(--jade);
}
.mission h3 { margin: 0 0 0.3rem; font-size: 0.86rem; letter-spacing: 0.1em; color: #1d6558; }
.mission p { margin: 0; }

.pied-ticket {
  margin-top: 1.8rem;
  padding-top: 0.9rem;
  border-top: 2px solid #2b2118;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #6a5a46;
}

/* ── Badges (jetons de foire) ─────────────────────────────────────────────── */

.jetons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.9rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.jeton {
  text-align: center;
  padding: 1rem 0.6rem 0.9rem;
  border: 2px solid var(--ampoule);
  border-radius: 999px / 22%;
  background: var(--encre-clair);
}

.jeton .pastille { font-size: 1.7rem; display: block; line-height: 1.2; }
.jeton b { display: block; font-size: 0.9rem; margin-top: 0.15rem; }
.jeton small { display: block; font-size: 0.78rem; color: var(--encre-doux); margin-top: 0.2rem; }

.jeton-manque {
  border-style: dashed;
  border-color: rgba(244, 231, 206, 0.3);
  background: transparent;
  opacity: 0.6;
}
.jeton-manque .pastille { filter: grayscale(1); }

/* ── Actions sous le ticket ───────────────────────────────────────────────── */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin: 2.4rem 0 0;
}

.actions .bouton { width: auto; }

.note-partage {
  text-align: center;
  min-height: 1.4rem;
  margin: 0.9rem 0 0;
  color: var(--ampoule);
  font-size: 0.92rem;
}

.chiffres-ticket {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 1.6rem;
  color: var(--encre-doux);
  font-size: 0.92rem;
}

/* ── Duel ─────────────────────────────────────────────────────────────────── */

.duel-formulaire {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.5rem;
}

.score-duel {
  text-align: center;
  margin: 2.5rem 0 1rem;
}

.score-duel .chiffre {
  font-family: var(--affiche);
  font-size: clamp(4rem, 18vw, 7.5rem);
  line-height: 1;
  color: var(--ampoule);
  text-shadow: 3px 3px 0 var(--rouge-fonce);
}

.score-duel h2 {
  font-family: var(--affiche);
  font-weight: 400;
  font-size: clamp(1.3rem, 4vw, 1.9rem);
  margin: 0.8rem 0 0.4rem;
}

.score-duel p { max-width: 46ch; margin: 0 auto; color: var(--encre-doux); }

.face-a-face {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.2rem;
  margin-top: 2.5rem;
}

.carte-joueur {
  padding: 1.2rem;
  background: var(--encre-clair);
  border: 1px solid rgba(244, 231, 206, 0.16);
  border-radius: var(--rayon-panneau);
  text-align: center;
}
.carte-joueur .pastille { font-size: 2.4rem; display: block; }
.carte-joueur b { display: block; font-size: 1.15rem; margin-top: 0.3rem; }
.carte-joueur small { color: var(--encre-doux); }

.tableau-ecarts { width: 100%; border-collapse: collapse; margin-top: 2rem; font-size: 0.95rem; }
.tableau-ecarts th,
.tableau-ecarts td { padding: 0.6rem 0.5rem; border-bottom: 1px solid rgba(244, 231, 206, 0.14); text-align: left; }
.tableau-ecarts th { font-weight: 600; color: var(--ampoule); }
.tableau-ecarts th:not(:first-child) { text-align: right; }
.tableau-ecarts td:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Divers ───────────────────────────────────────────────────────────────── */

.avis-parodie {
  margin: 3rem auto 0;
  max-width: 46rem;
  padding: 0.9rem 1.1rem;
  border: 1px dashed rgba(244, 231, 206, 0.35);
  border-radius: var(--rayon-panneau);
  color: var(--encre-doux);
  font-size: 0.88rem;
  text-align: center;
}

.centre { text-align: center; }

.chargement { text-align: center; color: var(--encre-doux); padding: 3rem 0; }

@media (max-width: 34rem) {
  .jauge-ligne { grid-template-columns: 8.5rem 1fr 2.4rem; font-size: 0.88rem; }
  .tampon { position: static; display: inline-block; transform: rotate(-3deg); margin-bottom: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
