/* ============================================================
   COULEURS DE LA MARQUE — change ces 4 lignes pour coller
   à la charte graphique de MS Procédures.
   ============================================================ */
:root {
  --brand-primary: #3E9C85;   /* vert sarcelle MS Procédures */
  --brand-accent:  #E8A23B;   /* orange du logo              */
  --brand-dark:    #2E7A67;   /* vert foncé (survol)         */
  --brand-light:   #eef7f4;   /* fond vert très clair        */

  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #d9def0;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(11,61,145,.12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--brand-light), #ffffff);
  min-height: 100vh;
}

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 22px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.topbar img { height: 92px; max-width: 78vw; object-fit: contain; }

#app { max-width: 920px; margin: 0 auto; padding: 26px 16px 60px; }

/* --- Écrans --- */
.screen { display: none; animation: fade .35s ease; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px 28px;
}
.center { text-align: center; }
h1 { color: var(--brand-primary); margin: 0 0 10px; }
h2 { color: var(--brand-primary); margin: 0 0 16px; }
h3 { color: var(--brand-dark); }
.lead { font-size: 1.15rem; }
.muted { color: var(--muted); }
.mt { margin-top: 26px; }
.opt { color: var(--muted); font-weight: 400; font-size: .85em; }

/* --- Choix du poste --- */
.choices { display: grid; gap: 14px; margin-top: 22px; }
.choice {
  display: flex; flex-direction: column; gap: 5px; text-align: center;
  padding: 16px 18px;
  border: 2px solid var(--brand-primary); border-radius: var(--radius);
  background: #fff; color: var(--brand-primary); cursor: pointer;
  transition: .18s;
}
.choice:hover { background: var(--brand-primary); color: #fff; transform: translateY(-2px); }
.choice-title { font-size: 1.05rem; font-weight: 700; }
.choice-desc { font-size: .86rem; font-weight: 400; opacity: .8; line-height: 1.35; }

/* --- Formulaires --- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit; padding: 11px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fff; font-weight: 400;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(11,61,145,.15);
}
textarea { resize: vertical; min-height: 120px; }

/* La zone de réponse du test occupe toute la largeur */
#questionArea textarea { width: 100%; min-height: 160px; }

/* Document (images) de la question 8 — zone défilable */
.doc-frame {
  width: 100%; height: 60vh; min-height: 360px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 10px; margin-bottom: 16px;
  background: #fff; padding: 8px;
}
.doc-frame img { display: block; width: 100%; height: auto; margin-bottom: 8px; }

/* --- Boutons --- */
.actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; }
.actions:has(> :only-child) { justify-content: center; }
.btn-primary, .btn-ghost {
  padding: 13px 24px; font-size: 1rem; font-weight: 600;
  border-radius: 10px; cursor: pointer; transition: .18s; border: none;
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--brand-primary); border: 1px solid var(--brand-primary); }
.btn-ghost:hover { background: var(--brand-light); }

.badge {
  display: inline-block; background: var(--brand-accent); color: var(--brand-dark);
  font-weight: 700; font-size: .8rem; padding: 5px 12px; border-radius: 999px; margin-bottom: 10px;
}

/* --- Formations dynamiques --- */
.formation {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px;
  border: 1px dashed var(--border); border-radius: 12px; padding: 14px; margin-bottom: 12px;
  position: relative;
}
.formation .full { grid-column: 1 / -1; }
.formation .remove {
  align-self: start; background: #fff0f0; color: #c0392b; border: 1px solid #f3caca;
  border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1.1rem;
}

.filename { color: var(--brand-primary); font-weight: 700; font-size: .82rem; }

.rules { text-align: left; line-height: 1.7; }
.rules li { margin-bottom: 8px; }

/* --- Test / chronomètre --- */
.test-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.timer { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--brand-primary); font-size: 1.2rem; }
.timer.danger { color: #c0392b; }
.timer-bar { height: 8px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 20px; }
#timerFill { height: 100%; width: 100%; background: var(--brand-primary); transition: width 1s linear; }
#timerFill.danger { background: #c0392b; }
.question-prompt { font-size: 1.15rem; font-weight: 600; margin-bottom: 14px; }

/* Faux document (Q8) */
.fake-doc {
  border: 1px solid var(--border); border-radius: 10px; padding: 20px;
  background: #fffef7; font-size: .95rem; line-height: 1.6; margin-bottom: 16px;
}
.fake-doc h4 { margin: 0 0 4px; }

.audio-controls { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }

/* Spinner + check */
.spinner {
  width: 46px; height: 46px; border: 5px solid var(--border);
  border-top-color: var(--brand-primary); border-radius: 50%;
  margin: 0 auto 18px; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.checkmark {
  width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%;
  background: #e8f7ee; color: #1e9e56; font-size: 2.4rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* --- Mobile --- */
@media (max-width: 620px) {
  .grid2, .formation { grid-template-columns: 1fr; }
  .card { padding: 22px 18px; }
  .actions { flex-direction: column-reverse; }
  .actions button { width: 100%; }
}


/* ---- Astérisque « champ obligatoire » ---- */
.req { color: #c0392b; font-weight: 700; }
.req-line { margin: 0 0 8px; font-size: .85rem; color: #666; }

/* ---- Poste sélectionné (choix multiple) ---- */
.choice.selected {
  background: var(--brand-primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(62,156,133,.25);
}
.choice.selected .choice-desc { opacity: .92; }

.btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

/* ---- Mention « une seule candidature » ---- */
.notice {
  margin-top: 18px;
  padding: 10px 14px;
  background: #fdf6e8;
  border-left: 4px solid var(--brand-accent, #E8A23B);
  border-radius: 8px;
  font-size: .88rem;
  color: #6b5324;
  text-align: left;
}

/* ---- Dictaphone (présentation orale) ---- */
.rec-box {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 16px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 12px; background: #fafafa;
}
.btn-rec {
  padding: 12px 20px; font-size: 1rem; font-weight: 600;
  border: 2px solid var(--brand-primary); border-radius: 10px;
  background: #fff; color: var(--brand-primary); cursor: pointer; transition: .18s;
}
.btn-rec:hover { background: var(--brand-primary); color: #fff; }
.btn-rec.recording { background: #c0392b; border-color: #c0392b; color: #fff; }
.rec-state { font-size: .9rem; font-weight: 600; color: #444; }
.rec-box audio { width: 100%; max-width: 420px; }
#recHint { font-size: .82rem; margin: 0; }

/* ---- Bouton de téléchargement (épreuve fichier) ---- */
.btn-download {
  display: inline-block; padding: 11px 20px; margin-bottom: 6px;
  background: var(--brand-primary); color: #fff; text-decoration: none;
  font-weight: 600; border-radius: 10px; transition: .18s;
}
.btn-download:hover { background: var(--brand-dark); }
