:root{
  --bg:#0b1020;
  --fg:#e5e7eb;
  --muted:rgba(229,231,235,.75);
  --panel:rgba(255,255,255,.06);
  --bd:rgba(255,255,255,.12);
  --accent:rgba(255,220,140,.95);

  --green:#4ade80;
  --red:#fb7185;

  --whiteW:45px;
  --whiteH:200px;
  --blackW:30px;
  --blackH:120px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; }
body{
  background:var(--bg);
  color:var(--fg);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

/* Écrans */
.screen{ display:none; padding:16px; }
.screen.active{ display:block; }

.container{
  max-width: 900px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 16px;
}

.subtitle{ color:var(--muted); margin-top:6px; }

.pseudo-input-group{
  margin: 14px 0;
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.pseudo-input-group input{
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--bd);
  background: rgba(255,255,255,.04);
  color: var(--fg);
  outline:none;
  min-width: 240px;
}

.btn-primary{
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--bd);
  background: rgba(255,220,140,.15);
  color: var(--fg);
  cursor:pointer;
  font-weight:700;
}
.btn-primary:hover{ background: rgba(255,220,140,.22); }

.instructions{
  margin-top: 14px;
  color: var(--muted);
}
.instructions .green{ color: var(--green); font-weight:700; }
.instructions .red{ color: var(--red); font-weight:700; }

/* HUD */
.hud{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom: 12px;
}
.hud-item{
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 14px;
  padding: 10px 12px;
  display:flex;
  gap:8px;
  align-items:baseline;
}
.hud-item .label{ color: var(--muted); }
.hud-item .value{ font-weight:800; }

/* Feedback */
.feedback{
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--bd);
  background: rgba(255,255,255,.06);
}
.feedback.hidden{ display:none; }
.feedback.correct{ border-color: rgba(74,222,128,.35); }
.feedback.wrong{ border-color: rgba(251,113,133,.35); }

/* Zone jeu (layout FIXE) */
.game-area{
  display:flex;
  align-items:flex-start;
  gap: 16px;
  flex-wrap: nowrap; /* fixe la mise en page, pas de saut */
}

/* Cadre boutons (zone verte/rouge) */
.answer-buttons-container{
  width: 210px;          /* réservé => position fixe */
  min-width: 210px;
}
.answer-buttons-side{
  width: 210px;
  height: 220px;         /* réservé => fixe */
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 12px;
  display:flex;
  gap: 10px;
  justify-content:center;
  align-items:center;
}

/* Boutons */
.btn-answer{
  width: 88px;
  height: 180px;
  border-radius: 16px;
  border: 1px solid var(--bd);
  background: rgba(255,255,255,.06);
  color: var(--fg);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 10px;
  font-weight:800;
}
.btn-answer:disabled{ cursor: default; }
.btn-icon{ font-size: 28px; }
.btn-text{ line-height: 1.0; text-align:center; }

.btn-correct{ border-color: rgba(74,222,128,.35); }
.btn-wrong{ border-color: rgba(251,113,133,.35); }

/* Cadre piano */
.piano{
  position: relative;
  display:flex;
  align-items:stretch;
  width: calc(14 * var(--whiteW));  /* 14 touches blanches */
  min-width: calc(14 * var(--whiteW));
  height: var(--whiteH);
  background: rgba(0,0,0,.15);
  border: 1px solid var(--bd);
  border-radius: 18px;
  overflow:hidden;
}

/* Touches */
.piano-key{
  user-select:none;
}

.white-key{
  width: var(--whiteW);
  height: var(--whiteH);
  border-right: 1px solid rgba(0,0,0,.35);
  background: rgba(255,255,255,.90);
  position: relative;
  cursor:pointer;
}
.black-key{
  width: var(--blackW);
  height: var(--blackH);
  background: rgba(20,20,20,.95);
  position:absolute;
  top: 0;
  border-radius: 0 0 8px 8px;
  border: 1px solid rgba(255,255,255,.08);
  cursor:pointer;
  z-index: 5;
}

.key-label{
  position:absolute;
  bottom: 6px;
  left: 0;
  right: 0;
  text-align:center;
  font-size: 11px;
  color: rgba(0,0,0,.65);
}
.black-key .key-label{
  color: rgba(255,255,255,.85);
  bottom: 4px;
  font-size: 10px;
}

/* Surbrillance note-énigme */
.piano-key.active{
  outline: 3px solid rgba(255,220,140,.95);
  outline-offset: -3px;
}

/* Panneau à droite (fixe) */
.side-panel{
  width: 280px;
  min-width: 280px;
  display:flex;
  flex-direction:column;
  gap: 12px;
}

/* Cadres “Écoutez la note” et “Bonus” (toujours visibles) */
.panel-box{
  width: 100%;
  height: 220px;           /* réservé => fixe */
  background: var(--panel);
  border: 1px solid var(--bd);
  border-radius: 18px;
  padding: 12px;
}

.panel-title{
  font-weight: 900;
  margin-bottom: 8px;
  color: var(--accent);
}

/* Timer circulaire */
.question-timer{
  display:flex;
  align-items:center;
  gap: 12px;
  margin-top: 8px;
}
.timer-circle{ display:block; }
.timer-bg{
  fill: none;
  stroke: rgba(255,255,255,.12);
  stroke-width: 10;
}
.timer-progress{
  fill:none;
  stroke: rgba(255,220,140,.95);
  stroke-width: 10;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
}
.timer-text{
  font-size: 28px;
  font-weight: 900;
}

/* Texte panneaux */
.question-text{ color: var(--muted); margin-top: 12px; }
.correction-text{ color: var(--muted); margin-top: 8px; }
.correction-timerline{ margin-top: 14px; font-weight: 800; }

/* ✅ Grisé au lieu de disparition */
.inactive{
  opacity: 0.35;
  filter: grayscale(1);
}
.inactive button{
  pointer-events: none;
}

/* Responsive simple */
@media (max-width: 1100px){
  .game-area{
    flex-wrap: wrap;
  }
  .side-panel{
    width: 100%;
    min-width: 0;
    flex-direction: row;
  }
  .panel-box{
    height: 200px;
    flex: 1 1 300px;
  }
}
