/* Révi — thème sobre : bleu / noir / rose saumon */
:root {
  --bleu: #15294d;
  --bleu-i: #2e5a8f;
  --encre: #14161c;
  --saumon: #ef9d8a;
  --saumon-pale: #fdeee9;
  --fond: #f5f6f8;
  --surface: #ffffff;
  --bord: #d6dbe3;
  --gris: #8893a3;
  --gris-txt: #5b6675;
  --ombre: 0 8px 24px rgba(20, 40, 80, 0.08);
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  display: flex;
  min-height: 100dvh;
}

/* ---------- Barre latérale ---------- */
#rail {
  background: var(--bleu);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 18px 12px;
  flex: 0 0 auto;
}
#rail[hidden] { display: none; }

.railbtn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: none;
  background: rgba(46, 90, 143, 0.5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.railbtn:hover { background: rgba(46, 90, 143, 0.85); }
.railbtn:active { transform: scale(0.94); }
.railbtn.accent { background: var(--saumon); color: var(--bleu); }
.railbtn.accent:hover { background: #e98b76; }
.railbtn svg { display: block; }

/* ---------- Zone principale ---------- */
#app {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--surface);
  border: 1px solid #e6e9ee;
  border-radius: 16px;
  box-shadow: var(--ombre);
  width: 100%;
  max-width: 480px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.logo-row { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.app-title { font-size: 34px; font-weight: 800; color: var(--bleu); letter-spacing: 1px; margin: 0; }
.subtitle { color: var(--gris); font-size: 14px; margin: 0; text-align: center; }
.label { text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; color: var(--gris); margin-bottom: 4px; }

.tag {
  display: inline-block;
  background: var(--bleu);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 12px;
  border-radius: 20px;
}

/* ---------- Boutons ---------- */
button { font-family: inherit; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: filter 0.15s, transform 0.08s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--bleu-i); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-dark { background: var(--bleu); color: #fff; }
.btn-dark:hover { filter: brightness(1.15); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Boutons de niveau */
.level-btn {
  border: 1.5px solid var(--bord);
  background: #fff;
  color: var(--bleu);
  border-radius: 10px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.level-btn:hover { border-color: var(--bleu-i); }
.level-btn.current { background: var(--bleu-i); color: #fff; border-color: var(--bleu-i); }

/* Champs */
.field-label { font-size: 13px; font-weight: 600; color: var(--gris-txt); margin-bottom: 6px; display: block; }
select.field, input.field {
  width: 100%;
  border: 1.5px solid var(--bord);
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  background: #fff;
  color: var(--encre);
}
select.field:focus, input.field:focus { outline: none; border-color: var(--bleu-i); }

.theme-wrap { position: relative; }
.suggestions {
  border: 1px solid #e2e6ec;
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: #fff;
  max-height: 180px;
  overflow-y: auto;
}
.suggestion {
  padding: 9px 12px;
  font-size: 14px;
  cursor: pointer;
  border-top: 1px solid #f0f2f5;
}
.suggestion:hover { background: var(--saumon-pale); }
.suggestion mark { background: transparent; color: var(--bleu-i); font-weight: 700; }
.hint { font-size: 13px; color: var(--gris-txt); }
.hint-list { font-size: 13px; color: var(--gris-txt); }
.hint-list b { color: var(--bleu); }

/* Interrupteur */
.toggle-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--gris-txt); }
.switch { position: relative; width: 44px; height: 24px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; cursor: pointer;
  background: #cfd6df; border-radius: 24px; transition: 0.2s;
}
.slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s;
}
.switch input:checked + .slider { background: var(--bleu-i); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* ---------- Quiz ---------- */
.quiz-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--gris); }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; }
.timer.low { color: #d9534f; }
.progress { height: 6px; background: #e6eaf0; border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--saumon); transition: width 0.3s; }
.question { font-size: 18px; font-weight: 600; color: var(--encre); line-height: 1.35; }

.choices { display: flex; flex-direction: column; gap: 10px; }
.choice {
  border: 1.5px solid var(--bord);
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: all 0.12s;
  color: var(--encre);
}
.choice:hover:not(:disabled) { border-color: var(--bleu-i); }
.choice.selected { border-color: var(--bleu-i); background: #eef3f9; }
.choice.good { border-color: var(--saumon); background: var(--saumon-pale); }
.choice.bad { border-color: #e6b3b3; background: #fbecec; }
.choice:disabled { cursor: default; }

.feedback { border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.4; }
.feedback.juste { background: var(--saumon-pale); color: #8a4a39; }
.feedback.presque { background: #fff4e6; color: #8a5a1f; }
.feedback.faux { background: #fbecec; color: #8a3232; }
.feedback .sol { font-weight: 700; }
.feedback .exp { display: block; margin-top: 4px; color: var(--gris-txt); }

/* Voile de pause */
.pause-veil {
  border: 1.5px dashed var(--bord);
  border-radius: 12px;
  padding: 48px 16px;
  text-align: center;
  color: var(--gris);
  background: #fafbfc;
  font-size: 16px;
}

/* ---------- Résultats ---------- */
.results { align-items: center; text-align: center; }
.gauge {
  --pct: 0;
  width: 168px; height: 168px; border-radius: 50%;
  background: conic-gradient(var(--saumon) calc(var(--pct) * 1%), #e6eaf0 0);
  display: flex; align-items: center; justify-content: center;
  margin: 6px auto;
}
.gauge-inner {
  width: 128px; height: 128px; border-radius: 50%; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.note { font-size: 34px; font-weight: 800; color: var(--bleu); line-height: 1; }
.note small { font-size: 16px; color: var(--gris); font-weight: 600; }
.pourcent { font-size: 14px; color: var(--gris); margin-top: 2px; }

/* ---------- Confirmation ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 24, 48, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50;
}
.modal {
  background: #fff; border-radius: 14px; padding: 22px; max-width: 340px; width: 100%;
  box-shadow: var(--ombre); display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.modal p { margin: 0; font-size: 15px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
.btn-ghost { background: #eef0f4; color: var(--gris-txt); }

/* ---------- Responsive : rail en bas sur mobile ---------- */
@media (max-width: 640px) {
  body { flex-direction: column; }
  #rail {
    flex-direction: row;
    justify-content: center;
    order: 2;
    padding: 10px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  #app { order: 1; padding: 16px; }
  .card { padding: 22px; }
}
