:root {

     /* Espacements Primitives du projet */
  --spacing-0: 0rem; /* 0px */
  --spacing-2: 0.125rem; /* 2px */
  --spacing-4: 0.25rem; /* 4px */
  --spacing-6: 0.375rem; /* 6px */
  --spacing-8: 0.5rem; /* 8px */
  --spacing-10: 0.625rem; /* 10px */
  --spacing-12: 0.75rem; /* 12px */
  --spacing-14: 0.875rem; /* 14px */
  --spacing-16: 1rem; /* 16px */
  --spacing-20: 1.25rem; /* 20px */
  --spacing-24: 1.5rem; /* 24px */
  --spacing-28: 1.75rem; /* 28px */
  --spacing-32: 2rem; /* 32px */
  --spacing-36: 2.25rem; /* 36px */
  --spacing-40: 2.5rem; /* 40px */
  --spacing-48: 3rem; /* 48px */

  /* Typographie Primitives du projet */
  --text-12: 0.75rem; /* 12px */
  --text-13: 0.8125rem; /* 13px */
  --text-14: 0.875rem; /* 14px */
  --text-16: 1rem; /* 16px */
  --text-18: 1.125rem; /* 18px */
  --text-20: 1.25rem; /* 20px */
  --text-24: 1.5rem; /* 24px */
  --text-28: 1.75rem; /* 28px */
  --text-30: 1.875rem; /* 30px */
  --text-38: 2.375rem; /* 38px */
  --text-48: 3rem; /* 48px */
  --text-64: 4rem; /* 64px */
  --text-80: 5rem; /* 80px */

  --bg: #0e0c0a;
  --surface: #181410;
  --border: #2e2820;
  --accent: #ff6b2b;
  --accent2: #ffd166;
  --text: #f0e8d8;
  --muted: #b39a7d;
  --success: #06d6a0;
  --danger: #ef233c;
  --glow: rgba(255, 107, 43, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Space Mono", monospace;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

/* Superposition de grain */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 100;
  opacity: 0.4;
}

/* Conteneur de particules */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  animation: floatUp linear forwards;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0.7;
  }
  100% {
    transform: translateY(-120px) scale(0);
    opacity: 0;
  }
}

/* ---- CARTE ---- */
.card {
  position: relative;
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  width: min(560px, 92vw);
  padding: var(--spacing-40) var(--spacing-36) var(--spacing-36);
  box-shadow:
    0 0 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: box-shadow 0.4s;
}

.card.glowing {
  box-shadow:
    0 0 80px var(--glow),
    0 0 0 1px rgba(255, 107, 43, 0.25);
}

/* Insigne */
.badge {
  font-family: sans-serif;
  font-size: var(--text-12);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--spacing-24);
  display: flex;
  align-items: center;
  gap: var(--spacing-8);
}

.badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

h1 {
  font-family: sans-serif;
  font-size: clamp(var(--text-28), 6vw, var(--text-38));
  font-weight: 800;
  line-height: 1.05;
  margin-bottom: var(--spacing-8);
  letter-spacing: -0.02em;
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.subtitle {
  font-size: var(--text-12);
  color: var(--muted);
  margin-bottom: var(--spacing-32);
  line-height: 1.6;
}

/* Encadré d'instructions */
.instructions {
  background: rgba(255, 107, 43, 0.07);
  border: 1px solid rgba(255, 107, 43, 0.2);
  border-radius: 3px;
  padding: var(--spacing-14) var(--spacing-16);
  font-size: var(--text-12);
  color: var(--text);
  margin-bottom: var(--spacing-28);
  line-height: 1.7;
}

.instructions strong {
  color: var(--accent2);
}

/* Affichage du volume */
.volume-wrap {
  margin-bottom: var(--spacing-24);
}

.volume-label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-12);
  color: var(--muted);
  margin-bottom: var(--spacing-8);
  letter-spacing: 0.05em;
}

.volume-label span {
  color: var(--text);
  font-weight: 700;
}

.bar-bg {
  height: 22px;
  background: #1e1a16;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}

.bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.05s linear;
  border-radius: 2px;
  position: relative;
}

.bar-fill::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: white;
  opacity: 0.5;
  filter: blur(3px);
}

/* Ligne de seuil */
.threshold-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--danger);
  z-index: 2;
  transition: left 0.2s;
}

.threshold-line::before {
  content: "SEUIL";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-12);
  letter-spacing: 0.1em;
  color: var(--danger);
  white-space: nowrap;
}

/* Indicateur gros emoji éternuement */
.sneeze-emoji {
  font-size: var(--text-64);
  text-align: center;
  margin: var(--spacing-20) 0 var(--spacing-8);
  display: block;
  transition: transform 0.1s;
  filter: grayscale(0.3);
  user-select: none;
}

.sneeze-emoji.wiggle {
  animation: wiggle 0.15s ease-in-out;
}

@keyframes wiggle {
  0% {
    transform: rotate(-8deg) scale(1.1);
  }
  50% {
    transform: rotate(8deg) scale(1.15);
  }
  100% {
    transform: rotate(0) scale(1);
  }
}

.sneeze-emoji.burst {
  animation: burst 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes burst {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.5) rotate(-5deg);
    filter: brightness(2);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

/* Texte de statut */
.status {
  text-align: center;
  font-size: var(--text-12);
  color: var(--muted);
  min-height: 20px;
  letter-spacing: 0.05em;
  margin-bottom: var(--spacing-28);
  transition: color 0.3s;
}

.status.active {
  color: var(--accent2);
}
.status.success {
  color: var(--success);
}

/* Bouton */
.btn {
  display: block;
  width: 100%;
  padding: var(--spacing-14) var(--spacing-20);
  background: var(--accent);
  color: #0e0c0a;
  font-family: sans-serif;
  font-size: var(--text-13);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.1s,
    box-shadow 0.2s;
}

.btn:hover {
  background: var(--accent2);
  box-shadow: 0 0 20px rgba(255, 209, 102, 0.3);
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  background: #2e2820;
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Note de bas de page */
.footer-note {
  font-size: var(--text-12);
  color: var(--muted);
  text-align: center;
  margin-top: var(--spacing-20);
  letter-spacing: 0.05em;
  opacity: 0.6;
}

/* ========== SUPERPOSITION DE SUCCÈS ========== */
#success-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 214, 160, 0.08);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s;
}

#success-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.success-card {
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: 4px;
  padding: var(--spacing-48) var(--spacing-40);
  text-align: center;
  max-width: 400px;
  width: 90vw;
  box-shadow: 0 0 80px rgba(6, 214, 160, 0.2);
  transform: scale(0.85);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#success-overlay.show .success-card {
  transform: scale(1);
}

.success-card .big-emoji {
  font-size: var(--text-80);
  display: block;
  margin-bottom: var(--spacing-16);
  animation: bounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

@keyframes bounce {
  0% {
    transform: scale(0) rotate(-20deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

.success-card h2 {
  font-family: sans-serif;
  font-size: var(--text-28);
  font-weight: 800;
  color: var(--success);
  margin-bottom: var(--spacing-10);
  letter-spacing: -0.02em;
}

.success-card p {
  font-size: var(--text-13);
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: var(--spacing-28);
}

.success-card .peak-label {
  font-size: var(--text-12);
  color: var(--text);
  background: rgba(6, 214, 160, 0.1);
  border: 1px solid rgba(6, 214, 160, 0.25);
  border-radius: 2px;
  display: inline-block;
  padding: var(--spacing-6) var(--spacing-14);
  margin-bottom: var(--spacing-28);
  letter-spacing: 0.08em;
}

.success-card .btn-reset {
  display: inline-block;
  padding: var(--spacing-10) var(--spacing-24);
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: "Space Mono", monospace;
  font-size: var(--text-12);
  letter-spacing: 0.08em;
  cursor: pointer;
  border-radius: 2px;
  transition:
    border-color 0.2s,
    color 0.2s;
}

.success-card .btn-reset:hover {
  border-color: var(--text);
  color: var(--text);
}

/* confettis en points */
.confetti-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  z-index: 300;
  animation: confettiFall 1.2s ease-in forwards;
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(250px) rotate(540deg) scale(0.3);
  }
}
