* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
  color: #d8d2c4;
  font-family: Georgia, "Times New Roman", serif;
}

#ecran {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover; /* l'image remplit tout l'écran : plus de bandes noires sur les côtés */
  image-rendering: pixelated;
}

#secteur {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.75;
}

#secteur[hidden] {
  display: none;
}

#indice {
  position: fixed;
  top: 62%;
  left: 50%;
  padding: 6px 14px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  font-size: 15px;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

#indice[hidden] {
  display: none;
}

#maintien {
  position: fixed;
  top: calc(62% + 40px);
  left: 50%;
  width: min(280px, 60vw);
  height: 12px;
  transform: translateX(-50%);
  border: 1px solid #e0b81e;
  background: rgba(0, 0, 0, 0.75);
}

#maintien[hidden] {
  display: none;
}

#maintien-barre {
  width: 0;
  height: 100%;
  background: #e0b81e;
}

#message {
  position: fixed;
  right: 16px;
  bottom: 76px;
  left: calc(min(300px, 40vw) + 32px); /* il ne passe jamais sur les objectifs */
  padding: 8px 14px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 16px;
  text-align: center;
}

#message[hidden] {
  display: none;
}

#objectifs {
  position: fixed;
  top: 16px;
  left: 16px;
  width: min(300px, 40vw);
  padding: 10px 12px;
  border-left: 3px solid #e0b81e;
  background: rgba(0, 0, 0, 0.72);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  line-height: 1.35;
}

#objectifs[hidden] {
  display: none;
}

#objectifs h3 {
  margin: 0 0 6px;
  color: #e0b81e;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ligne-cartes {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #4a463c;
}

#cartes {
  display: flex;
  gap: 4px;
}

#cartes span {
  width: 20px;
  height: 13px;
  border: 1px solid #7fd4e6;
  border-radius: 2px;
}

#cartes span.obtenue {
  background: #7fd4e6;
}

#liste-objectifs {
  margin: 8px 0 0;
  line-height: 1.35;
}

#liste-objectifs li {
  position: relative;
  padding: 4px 6px 4px 24px;
}

#liste-objectifs li::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 4px;
  width: 11px;
  height: 11px;
  border: 1px solid #d8d2c4;
}

#liste-objectifs strong,
#liste-objectifs span {
  display: block;
}

#liste-objectifs strong {
  color: #fff;
}

/* Seul l'objectif en cours détaille ce qu'il faut faire : le reste ne cache pas le jeu. */
#liste-objectifs li:not(.actif) span {
  display: none;
}

#liste-objectifs li.actif {
  background: rgba(224, 184, 30, 0.2);
}

#liste-objectifs li.actif strong {
  color: #f2cf45;
}

#liste-objectifs li.verrouille {
  opacity: 0.6;
}

#liste-objectifs li.fait {
  opacity: 0.55;
}

#liste-objectifs li.fait::before {
  border-color: #38d68c;
  background: #38d68c;
}

#boussole {
  position: fixed;
  top: 46px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  white-space: nowrap;
}

#boussole[hidden] {
  display: none;
}

#fleche {
  width: 18px;
  height: 18px;
  background: #e0b81e;
  clip-path: polygon(50% 0, 100% 100%, 50% 75%, 0 100%);
}

#qte {
  position: fixed;
  inset: 0;
  text-align: center;
  pointer-events: none;
}

#qte[hidden],
#qte-touche[hidden] {
  display: none;
}

#qte strong {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ff1f14;
  font-size: clamp(38px, 8vw, 54px);
  font-weight: bold;
  line-height: 60px;
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-shadow: 0 0 12px #000, 0 2px 4px #000;
}

#qte p {
  position: absolute;
  top: calc(50% + 34px);
  left: 50%;
  width: calc(100vw - 32px);
  margin: 0;
  transform: translateX(-50%);
  font-size: 14px;
  text-shadow: 0 1px 3px #000;
}

#qte-compte {
  margin-left: 8px;
  color: #38d68c;
  white-space: nowrap;
}

/* La touche apparaît à un endroit différent à chaque fois : main.js règle left et top. */
#qte-touche {
  position: absolute;
  width: 84px;
  height: 84px;
  transform: translate(-50%, -50%);
}

#qte-lettre {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #e0b81e;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 46px;
}

#qte-cercle {
  position: absolute;
  inset: 0;
  border: 3px solid #ff1f14;
  border-radius: 50%;
}

.victoire-titre {
  color: #7fd4e6;
}

#endurance {
  position: fixed;
  left: 50%;
  bottom: 28px;
  width: min(320px, 70vw);
  transform: translateX(-50%);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0.85;
}

#endurance[hidden] {
  display: none;
}

#endurance-cadre {
  height: 8px;
  margin-top: 6px;
  border: 1px solid #6b6558;
  background: #0b0a09;
}

#endurance-barre {
  width: 100%;
  height: 100%;
  background: #cfc7b2;
}

#endurance-barre.essouffle {
  background: #8a1c14;
}

.panneau {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.82);
  text-align: center;
}

.panneau[hidden] {
  display: none;
}

h1,
h2 {
  margin: 0 0 16px;
  font-weight: normal;
  letter-spacing: 0.08em;
}

h1 {
  font-size: clamp(40px, 8vw, 72px);
  color: #b3261a;
}

h2 {
  font-size: clamp(28px, 5vw, 44px);
  color: #b3261a;
}

ul {
  margin: 16px 0 28px;
  padding: 0;
  list-style: none;
  line-height: 2.2;
}

kbd {
  padding: 2px 7px;
  border: 1px solid #6b6558;
  border-radius: 3px;
  font-family: inherit;
  font-size: 0.9em;
}

button {
  padding: 12px 36px;
  border: 1px solid #b3261a;
  background: transparent;
  color: #d8d2c4;
  font: inherit;
  letter-spacing: 0.1em;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  background: #b3261a;
  color: #fff;
  outline: none;
}

#cinematique {
  position: fixed;
  inset: 0;
  cursor: pointer;
}

#cinematique[hidden] {
  display: none;
}

#bouton-passer {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 8px 18px;
  background: rgba(0, 0, 0, 0.55);
}

#cartouche {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 44px 16px 22px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 60%, rgba(0, 0, 0, 0));
  text-align: center;
}

#histoire-restante {
  visibility: hidden;
}

#histoire {
  max-width: 760px;
  min-height: 3em;
  margin: 0 auto;
  font-size: clamp(17px, 2.6vw, 24px);
  line-height: 1.5;
  text-wrap: balance;
}

#suite {
  min-height: 1.4em;
  margin: 12px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  opacity: 0.65;
}

#parametres {
  background: rgba(0, 0, 0, 0.95);
  overflow-y: auto;
  justify-content: safe center;
}

.boutons-menu {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(280px, 100%);
}

#reglages {
  width: min(520px, 100%);
  margin-bottom: 22px;
}

.reglage {
  display: grid;
  grid-template-columns: 1fr 170px 56px;
  gap: 12px;
  align-items: center;
  min-height: 36px;
  font-size: 15px;
  text-align: left;
}

.reglage input {
  width: 100%;
  margin: 0;
  accent-color: #b3261a;
  cursor: pointer;
}

.reglage output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.boutons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

button.secondaire {
  border-color: #6b6558;
  font-size: 14px;
  padding: 12px 20px;
}

button.secondaire:hover,
button.secondaire:focus-visible {
  background: #6b6558;
}

@media (max-width: 480px) {
  .reglage {
    grid-template-columns: 1fr 56px;
  }

  .reglage input {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* L'écran-titre : le canevas animé se voit derrière le texte, assombri là où on doit lire. */
#accueil {
  background: radial-gradient(ellipse 75% 42% at 50% 56%, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0));
}

.surtitre {
  margin: 0 0 6px;
  color: #9fe3f2;
  font-size: clamp(15px, 2.2vw, 28px);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-shadow: 0 0 8px #000, 0 2px 4px #000;
}

#accueil h1 {
  margin: 0;
  color: #d3180c;
  font-size: clamp(64px, min(17vw, 31vh), 300px);
  font-weight: bold;
  line-height: 1;
  letter-spacing: 0.04em;
  text-shadow: 0 0 6px #000, 0 0 26px #000, 0 0 40px rgba(217, 42, 28, 0.8), 0 5px 8px #000;
  animation: neon-en-panne 7s infinite;
}

#accueil h1 {
  position: relative;
}

/* Le sang suinte du pied des lettres : tout est en "em", donc il suit la taille du titre.
   Il naît d'un évasement collé à la lettre et finit par une grosse goutte ronde. */
.goutte {
  position: absolute;
  top: 0.825em;
  left: var(--x);
  width: 0.03em;
  height: var(--long);
  margin-left: -0.015em;
  border-radius: 0 0 0.02em 0.02em;
  background: linear-gradient(#d3180c, #a30f06);
  animation: couler 16s ease-in-out infinite;
  animation-delay: var(--delai);
}

.goutte::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 0.11em;
  height: 0.05em;
  transform: translateX(-50%);
  background: #d3180c;
  clip-path: polygon(0 0, 100% 0, 62% 100%, 38% 100%);
}

.goutte::after {
  content: "";
  position: absolute;
  bottom: -0.035em;
  left: 50%;
  width: 0.055em;
  height: 0.075em;
  transform: translateX(-50%);
  border-radius: 50% 50% 50% 50% / 38% 38% 62% 62%;
  background: radial-gradient(circle at 38% 35%, #f0402c 0 12%, #b81208 45%, #8a0b05);
}

@keyframes couler {
  0% { height: 0.01em; opacity: 0; }
  5% { height: 0.01em; opacity: 1; }
  65% { height: var(--long); opacity: 1; }
  90% { height: var(--long); opacity: 1; }
  100% { height: var(--long); opacity: 0; }
}

/* Le titre grésille de temps en temps, comme un néon qui lâche. */
@keyframes neon-en-panne {
  0%, 91%, 94%, 97%, 100% { opacity: 1; }
  92%, 96% { opacity: 0.35; }
  93% { opacity: 0.8; }
}

@media (prefers-reduced-motion: reduce) {
  #accueil h1 { animation: none; }
  .goutte { animation: none; }
}

.bande-danger {
  width: min(640px, 80vw);
  height: 10px;
  margin: 14px 0;
  background: repeating-linear-gradient(135deg, #d1a91f 0 16px, #14120c 16px 32px);
}

.accroche {
  margin: 0 0 clamp(14px, 3vh, 34px);
  font-size: clamp(20px, 3vw, 38px);
  font-style: italic;
  text-shadow: 0 0 8px #000, 0 2px 4px #000;
}

/* Le bouton : une plaque de métal rouge, encadrée de bandes de danger, qui bat comme un cœur. */
#bouton-commencer {
  position: relative;
  padding: clamp(12px, 2.6vh, 28px) clamp(56px, 8vw, 120px);
  border: 3px solid #e0301f;
  border-radius: 3px;
  background: linear-gradient(#4a0f0a, #1c0503);
  box-shadow: 0 0 22px rgba(224, 48, 31, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 0 22px rgba(0, 0, 0, 0.75);
  color: #f6ead6;
  font-size: clamp(22px, 3.4vw, 42px);
  font-weight: bold;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-shadow: 0 2px 3px #000;
  transition: transform 0.15s ease, background 0.15s ease;
  animation: bouton-coeur 1.6s ease-in-out infinite;
}

#bouton-commencer::before,
#bouton-commencer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: clamp(14px, 2vw, 26px);
  background: repeating-linear-gradient(135deg, #d1a91f 0 8px, #14120c 8px 16px);
}

#bouton-commencer::before { left: 0; }
#bouton-commencer::after { right: 0; }

#bouton-commencer:hover,
#bouton-commencer:focus-visible {
  transform: scale(1.06);
  background: linear-gradient(#b3200f, #5e0a05);
  color: #fff;
}

@keyframes bouton-coeur {
  0%, 100% { box-shadow: 0 0 18px rgba(224, 48, 31, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 0 22px rgba(0, 0, 0, 0.75); }
  15% { box-shadow: 0 0 42px rgba(255, 60, 40, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 0 22px rgba(0, 0, 0, 0.75); }
  30% { box-shadow: 0 0 22px rgba(224, 48, 31, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 0 22px rgba(0, 0, 0, 0.75); }
  45% { box-shadow: 0 0 34px rgba(255, 60, 40, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 0 22px rgba(0, 0, 0, 0.75); }
}

#accueil .astuce {
  font-size: clamp(14px, 1.9vw, 24px);
  opacity: 0.85;
  text-shadow: 0 1px 3px #000;
}

@media (prefers-reduced-motion: reduce) {
  #bouton-commencer { animation: none; }
}

/* Le voile noir des fondus, par-dessus tout le reste. */
#voile {
  position: fixed;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease;
}

#voile.noir {
  opacity: 1;
  pointer-events: auto;
}

#regles {
  background: #000;
  overflow-y: auto;
  justify-content: safe center;
}

.colonnes-regles {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 48px;
  justify-content: center;
  max-width: 1200px;
  margin-bottom: 20px;
  font-size: clamp(16px, 1.7vw, 24px);
  text-align: left;
}

.colonnes-regles > div {
  flex: 1 1 300px;
}

.colonnes-regles h3 {
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #b8951c;
  color: #e0b81e;
  font-size: 1.05em;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.colonnes-regles p {
  margin: 0 0 8px;
  line-height: 1.45;
}

.colonnes-regles ol {
  margin: 0 0 8px;
  padding-left: 22px;
  line-height: 1.6;
}

.colonnes-regles ul {
  margin: 0;
  line-height: 2.2;
}

.astuce {
  margin-top: 16px;
  font-size: 14px;
  opacity: 0.7;
}
