.embouchure-challenge {
  --ec-accent: #f59e0b;
  --ec-good: #10b981;
  --ec-bad: #ef4444;
  --ec-text: #ffffff; 
  --ec-dark-bg: #0f172a;
  --ec-font: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  
  position: relative;
  display: block;
  width: 100%; 
  max-width: 1280px; 
  margin: 30px auto;
  font-family: var(--ec-font);
  color: var(--ec-text);
  user-select: none;
  box-sizing: border-box;
}

/* --- SCÈNE --- */
.embouchure-challenge .ec-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  min-height: 600px;
  background-size: cover;
  background-position: center top;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
  background-color: var(--ec-dark-bg); 
  cursor: crosshair;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- BOUTON MENU --- */
.ec-btn-icon {
    position: absolute;
    top: 20px; left: 20px;
    width: 50px; height: 50px; 
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.4);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    z-index: 60;
    backdrop-filter: blur(4px);
    transition: background 0.2s;
    display: flex; align-items: center; justify-content: center;
    touch-action: manipulation;
}
.ec-btn-icon:hover, .ec-btn-icon:active { background: rgba(0,0,0,0.7); }

/* --- VIES --- */
.ec-lives {
    position: absolute;
    top: 20px; right: 20px; z-index: 50;
    font-size: 2rem; letter-spacing: 5px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* --- RUNNER & MASQUE --- */
.ec-runner {
  position: absolute; top: 0; bottom: 0; left: 0; right: 0; 
  z-index: 10; pointer-events: none;
  clip-path: inset(50% 0 0 0);
}

.ec-mouthpiece {
  position: absolute;
  height: 160px; max-height: 25%; width: auto;
  top: 60%; 
  left: 50%; transform: translateX(-50%);
  will-change: transform, top;
  filter: drop-shadow(0 15px 25px rgba(0,0,0,0.6));
  transition: top 2s cubic-bezier(0.25, 1, 0.5, 1);
}

.ec-mouthpiece.ec-moving-up { top: 50%; }
.ec-mouthpiece.ec-hit { top: 42%; transition: top 1.5s ease-out; }
.ec-mouthpiece.ec-shake { animation: ec-shake-anim 0.5s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes ec-shake-anim {
  10%, 90% { transform: translate3d(calc(-50% - 1px), 0, 0); }
  20%, 80% { transform: translate3d(calc(-50% + 2px), 0, 0); }
  30%, 50%, 70% { transform: translate3d(calc(-50% - 4px), 0, 0); }
  40%, 60% { transform: translate3d(calc(-50% + 4px), 0, 0); }
}

/* --- HUD --- */
.ec-hud {
  position: relative;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; 
  background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(10px);
  border-radius: 0 0 16px 16px; margin-top: -55px; z-index: 20;
  border-top: 1px solid rgba(255,255,255,0.1); height: 55px;
}
.ec-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: rgba(255,255,255,0.6); margin-right: 8px; font-weight: 700; }
.ec-center-marker { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 100px; height: 100%; display: flex; align-items: center; justify-content: center; }
.ec-aim { width: 50px; height: 4px; border-radius: 10px; background: var(--ec-accent); box-shadow: 0 0 15px var(--ec-accent); }
#ec-level, #ec-prec { font-weight: 800; color: #fff; font-size: 1.1em; }

/* --- OVERLAYS --- */
.ec-overlay {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(15px); 
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 100; padding: 20px; border-radius: 16px;
}
.ec-overlay[hidden] { display: none !important; }
.ec-card { 
    width: 100%; max-width: 420px; 
    padding: 20px; 
    display: flex; flex-direction: column; align-items: center; 
    /* Sécurité pour la carte elle-même */
    max-height: 90%;
    overflow-y: auto; 
}

.ec-overlay h3 { font-size: 2.2rem; margin: 0 0 10px; text-transform: uppercase; font-weight: 900; color: white; }
.ec-overlay h4 { font-size: 1.5rem; margin: 0 0 1rem; color: var(--ec-accent); font-weight: 800; text-transform: uppercase; }
.ec-overlay p { font-size: 0.95rem; color: #cbd5e1; margin-bottom: 1.5rem; text-align: center; }

/* --- BOUTONS --- */
.ec-actions { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 300px; }
.ec-actions.row { flex-direction: row; justify-content: center; gap: 20px; margin-top: 20px; width: 100%; }

.ec-btn {
  border: none; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  color: white; padding: 12px 16px; border-radius: 8px;
  font-weight: 600; text-transform: uppercase; font-size: 13px;
  cursor: pointer; transition: all 0.2s; width: 100%; text-align: center;
}
.ec-btn:hover { background: rgba(255,255,255,0.15); transform: translateY(-2px); }

.ec-btn.ec-primary {
  background: var(--ec-accent); border-color: var(--ec-accent);
  color: #fff; font-size: 14px; padding: 14px 20px;
  box-shadow: 0 4px 15px -5px var(--ec-accent); font-weight: 700;
}

.ec-card input, .ec-select { width: 100%; padding: 12px; background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; color: white; margin-bottom: 12px; text-align:center; }

/* --- LISTE SCORES (SCROLLABLE) --- */
.ec-top { 
    list-style: none; 
    padding: 0; 
    width: 100%; 
    margin: 0 auto 1.5rem; 
    
    /* LIMITE HAUTEUR & SCROLL */
    max-height: 220px; /* Environ 5 lignes */
    overflow-y: auto;
    padding-right: 5px; /* Espace pour la scrollbar */
    
    /* Style Scrollbar (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: var(--ec-accent) rgba(255,255,255,0.1);
}

/* Style Scrollbar (Chrome/Safari/Webkit) */
.ec-top::-webkit-scrollbar { width: 6px; }
.ec-top::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 4px; }
.ec-top::-webkit-scrollbar-thumb { background-color: var(--ec-accent); border-radius: 10px; }

.ec-top li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 0.9rem; }

.ec-fail-reason { color: var(--ec-bad); font-weight: 700; font-size: 1.1rem; display: block; margin-top: 5px; text-transform: uppercase; }

@media (max-width: 768px) {
    .embouchure-challenge .ec-stage { min-height: 400px; }
    .ec-mouthpiece { height: 120px; } 
}