/* ========================
   LAYOUT
======================== */

#menu,
#trainingScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

/* ========================
   MENU
======================== */

#menu {
  margin-top: 100px;
  text-align: center;
}

#menu h1 {
  margin-bottom: 20px;
}

#menu button {
  padding: 12px 20px;
  margin: 10px;
  font-size: 16px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

#menu button:hover {
  background: var(--accent-hover);
}

/* ========================
   READY BUTTON
======================== */

#readyBtn {
  display: block;
  margin: 40px auto;
  padding: 18px 40px;
  font-size: 26px;
  font-weight: bold;

  border: none;
  border-radius: 12px;

  background: var(--accent);
  color: var(--on-accent);

  cursor: pointer;
}

#readyBtn:hover {
  background: var(--accent-hover);
}

/* ========================
   COUNTDOWN
======================== */

#countdown {
  text-align: center;
  font-size: 60px;
  font-weight: bold;
  margin: 30px 0;
}

#countdown.error {
  font-size: 18px;
  color: rgb(245,48,48);
}

/* ========================
   ENTRAINEMENT : CARTE
======================== */

#app {
  background: white;
  width: 95%;
  max-width: 520px;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

/* ========================
   QUESTION
======================== */

#question {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 25px;
}

/* ========================
   ANSWERS
======================== */

#answers {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

#answers button {
  padding: 12px;
  font-size: 16px;
  border-radius: 10px;
  border: 2px solid var(--accent);
  background: white;
  cursor: pointer;
  transition: 0.2s;
}

/* le survol ne marche que tant qu'on n'a pas répondu */
#answers:not(.locked) button:hover {
  background: var(--accent);
  color: var(--on-accent);
}

#answers.locked button {
  cursor: default;
}

/* ========================
   CORRECTION
======================== */

.correct {
  background: rgb(9,187,69) !important;
  border-color: rgb(9,187,69) !important;
  color: white;
}

.incorrect {
  background: rgb(245,48,48) !important;
  border-color: rgb(245,48,48) !important;
  color: white;
}

/* ========================
   EXPLICATION
======================== */

#explanation {
  margin-bottom: 25px;
  padding: 15px 18px;
  background: var(--accent-soft);
  border-left: 6px solid var(--accent);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.5;
}

/* ========================
   BOUTON SUIVANT
======================== */

#next {
  width: 100%;
  padding: 12px;
  font-size: 17px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

#next:hover {
  background: var(--accent-hover);
}

/* ========================
   EXAMEN : STRUCTURE
======================== */

#examScreen {
  width: 95%;
  max-width: 700px;
  margin: 0 auto;
  padding: 20px 0 30px;
}

.card {
  background: white;
  padding: 25px;
  border-radius: 15px;
  box-shadow: 0 0 15px rgba(0,0,0,0.1);
}

#examIntro h2 {
  margin-top: 0;
}

.exam-rules {
  padding-left: 20px;
  line-height: 1.7;
  color: #444;
}

.exam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

/* ========================
   EXAMEN : BOUTONS
======================== */

.exam-btn {
  padding: 12px 22px;
  font-size: 16px;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
}

.exam-btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.exam-btn.secondary {
  background: transparent;
  color: var(--accent-text);
}

.exam-btn.secondary:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.exam-btn.small {
  padding: 8px 14px;
  font-size: 14px;
}

.invisible {
  visibility: hidden;
}

/* ========================
   EXAMEN : BARRE (chrono toujours visible)
======================== */

#examBar {
  position: sticky;
  top: 0;
  z-index: 10;

  margin-bottom: 14px;
  padding: 10px 0;

  background: #f5f6fa;
  border-bottom: 1px solid #e1e5ee;
}

.exam-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#examCounter {
  font-size: 14px;
  color: #555;
}

#examTimer {
  font-size: 22px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
}

#examTimer.warning {
  color: rgb(220,38,38);
}

#examConfirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;

  margin-top: 10px;
  padding: 10px 12px;

  background: var(--accent-soft);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  font-size: 14px;
}

#examConfirmText {
  flex: 1 1 200px;
}

/* ========================
   EXAMEN : QUESTION
======================== */

#examCard {
  scroll-margin-top: 90px;
}

#examQuestion {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
}

#examAnswers {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.exam-answer {
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  font-size: 16px;
  background: white;
  border: 2px solid #cfd6e4;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.exam-answer:hover {
  border-color: var(--accent);
}

.exam-answer.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.exam-nav {
  display: flex;
  justify-content: space-between;
}

/* ========================
   EXAMEN : LES CARRES
======================== */

#examGrid,
#resultGrid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

#examGrid {
  margin-top: 20px;
}

#resultGrid {
  margin: 20px 0 8px;
}

.sq {
  width: 36px;
  height: 36px;
  padding: 0;

  font-size: 13px;
  color: #444;
  background: white;
  border: 2px solid #cfd6e4;
  border-radius: 8px;
  cursor: pointer;
}

.sq:hover {
  border-color: var(--accent);
}

/* répondue */
.sq.answered {
  background: var(--accent-soft);
  border-color: var(--accent);
}

/* question affichée */
.sq.current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: bold;
}

/* ========================
   RESULTAT
======================== */

.result-summary {
  text-align: center;
}

.result-summary .exam-actions {
  justify-content: center;
}

#resultTitle {
  margin: 0 0 6px;
}

#resultScore {
  margin: 0;
  font-size: 48px;
  font-weight: bold;
  color: var(--accent-text);
}

#resultDetail {
  margin: 6px 0 0;
  font-size: 14px;
  color: #555;
}

/* couleurs communes : carrés du résultat, pastilles de légende */
.sq.ok,
.chip.ok {
  background: #e8f8ee;
  border-color: rgb(9,187,69);
  color: #0a6b2c;
}

.sq.ko,
.chip.ko {
  background: #fdeaea;
  border-color: rgb(245,48,48);
  color: #a31d1d;
}

.sq.skip,
.chip.skip {
  background: white;
  border-style: dashed;
  border-color: #9aa4b8;
  color: #666;
}

.legend {
  margin: 0 0 4px;
  font-size: 13px;
  color: #555;
}

.chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 0 2px 0 10px;
  vertical-align: -1px;
  border: 2px solid;
  border-radius: 3px;
}

/* ========================
   RESULTAT : CORRECTION
======================== */

#reviewFilter {
  display: flex;
  gap: 8px;
  margin: 20px 0 4px;
}

.review-item {
  scroll-margin-top: 12px;
  margin-top: 12px;
  padding: 16px 18px;

  background: white;
  border-left: 6px solid #9aa4b8;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(0,0,0,0.06);
}

.review-item.ok {
  border-left-color: rgb(9,187,69);
}

.review-item.ko {
  border-left-color: rgb(245,48,48);
}

.review-status {
  font-size: 13px;
  font-weight: bold;
  color: #555;
}

.review-status.ok {
  color: #0a6b2c;
}

.review-status.ko {
  color: #a31d1d;
}

.review-q {
  margin: 6px 0 12px;
  font-weight: 600;
}

.review-answer {
  display: flex;
  justify-content: space-between;
  gap: 10px;

  margin-bottom: 6px;
  padding: 8px 12px;

  font-size: 15px;
  border: 2px solid #e1e5ee;
  border-radius: 8px;
}

.review-answer.is-correct {
  background: #e8f8ee;
  border-color: rgb(9,187,69);
}

.review-answer.is-wrong {
  background: #fdeaea;
  border-color: rgb(245,48,48);
}

.review-tag {
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  color: #444;
}

.review-explanation {
  margin-top: 10px;
  padding: 10px 14px;

  font-size: 14px;
  line-height: 1.5;
  background: var(--accent-soft);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
}

/* ========================
   MOBILE
======================== */

@media (max-width: 480px) {

  #answers {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 18px;
  }

  #examQuestion {
    font-size: 18px;
  }

  .review-answer {
    flex-direction: column;
    gap: 2px;
  }

}
