
* {
  box-sizing: border-box;
}

:root {
  --papier: #f0dfc0;
  --papier-fonce: #d9c49e;
  --encre: #29221f;
  --turquoise: #2dd4bf;
  --jaune: #facc15;
  --orange: #fb923c;
  --fonce-1: #400204;
  --fonce-2: #330127;
  --fonce-3: #3a1302;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 32px 16px;
  background:
    radial-gradient(circle at 15% 15%, #fff7e7 0, transparent 32%),
    var(--papier);
  color: var(--encre);
  font-family: "Trebuchet MS", Arial, sans-serif;
}

.jeu {
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
}

.entete {
  text-align: center;
  margin-bottom: 30px;
}

.surtitre {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 4px;
}

h1 {
  margin: 8px 0;
  font-size: clamp(42px, 9vw, 68px);
  letter-spacing: -4px;
  line-height: 1;
}

h1 span {
  color: #9c542c;
}

.description {
  margin: 12px 0 0;
  color: #74614b;
  font-size: 14px;
}

.equipes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.equipe {
  min-width: 0;
  padding: 18px;
  border: 2px solid transparent;
  border-radius: 18px;
  background: rgba(255, 249, 235, 0.65);
  text-align: center;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.equipe.active {
  border-color: #29221f;
  box-shadow: 0 5px 0 rgba(41, 34, 31, 0.12);
  transform: translateY(-3px);
}

.info-equipe {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.info-equipe h2 {
  margin: 0;
  font-size: 20px;
}

.indicateur {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b5a58d;
}

#equipe-claire .indicateur {
  background: var(--turquoise);
}

#equipe-fonce .indicateur {
  background: var(--fonce-1);
}

.equipe p {
  margin: 7px 0 14px;
  color: #786751;
  font-size: 12px;
}

.cercle {
  display: block;
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border: 3px solid rgba(41, 34, 31, 0.13);
  border-radius: 50%;
  cursor: grab;
  touch-action: none;
  box-shadow:
    inset -5px -6px 0 rgba(0, 0, 0, 0.12),
    0 5px 8px rgba(41, 34, 31, 0.15);
  transition: transform 0.2s, opacity 0.2s;
}

.cercle:hover {
  transform: scale(1.08) rotate(-5deg);
}

.cercle:active {
  cursor: grabbing;
}

.cercle-claire {
  background: var(--turquoise);
}

.cercle-fonce {
  background: var(--fonce-1);
}

.cercle.inactif {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.35);
}

.zone-jeu {
  padding: 22px;
  border: 2px solid rgba(41, 34, 31, 0.12);
  border-radius: 22px;
  background: rgba(255, 249, 235, 0.55);
}

.statut {
  min-height: 66px;
  margin-bottom: 16px;
  text-align: center;
}

#message {
  margin: 0 0 7px;
  font-size: 24px;
  font-weight: 900;
}

#instruction {
  margin: 0;
  color: #786751;
  font-size: 13px;
}

#grille {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  aspect-ratio: 1;
  padding: 10px;
  border: 2px solid #c8a878;
  border-radius: 17px;
  background: #dfc79f;
  box-shadow: inset 0 2px 5px rgba(41, 34, 31, 0.1);
}

.case {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 2px dashed rgba(102, 76, 45, 0.22);
  border-radius: 12px;
  background: rgba(255, 248, 231, 0.85);
  transition: background-color 0.2s, transform 0.2s, border-color 0.2s;
}

.case.survol {
  border-color: #29221f;
  transform: scale(0.96);
  background: #fff8e9;
}

.case.remplie {
  border-style: solid;
  border-color: rgba(41, 34, 31, 0.14);
  animation: apparition 0.3s ease-out;
}

.case.gagnante {
  z-index: 1;
  outline: 4px solid #fff9eb;
  box-shadow: 0 0 0 7px #29221f;
  animation: gagnante 0.7s ease-in-out infinite alternate;
}

.case.splash::after {
  position: absolute;
  width: 25%;
  aspect-ratio: 1;
  border: 3px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  content: "";
  animation: eclaboussure 0.45s ease-out forwards;
  pointer-events: none;
}

#replay {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px 18px;
  border: 2px solid var(--encre);
  border-radius: 12px;
  background: var(--encre);
  color: #fff8e9;
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
}

#replay:hover {
  transform: translateY(-2px);
  background: #4a3930;
}

#replay:active {
  transform: translateY(1px);
}

footer {
  margin-top: 20px;
  text-align: center;
  color: #786751;
  font-size: 12px;
}

.paint-drop {
  position: fixed;
  z-index: 1000;
  top: -60px;
  width: var(--taille, 22px);
  height: calc(var(--taille, 22px) * 1.2);
  border-radius: 45% 55% 65% 35%;
  pointer-events: none;
  animation: peintureTombe var(--duree, 3s) ease-in forwards;
}

@keyframes apparition {
  0% {
    transform: scale(0.65) rotate(-8deg);
    filter: saturate(1.6);
  }
  70% {
    transform: scale(1.08) rotate(3deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes eclaboussure {
  from {
    transform: scale(0.3);
    opacity: 0.9;
  }
  to {
    transform: scale(4);
    opacity: 0;
  }
}

@keyframes gagnante {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.035);
  }
}

@keyframes peintureTombe {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(115vh) rotate(var(--rotation, 360deg));
    opacity: 0.85;
  }
}

@media (max-width: 420px) {
  body {
    padding: 22px 12px;
  }

  .equipe {
    padding: 14px 8px;
  }

  .zone-jeu {
    padding: 14px;
  }

  #grille {
    gap: 7px;
    padding: 7px;
  }

  .case {
    border-radius: 9px;
  }

  #message {
    font-size: 21px;
  }
}
