/* =====================================================================
   Quiz Citations — Concours · feuille de style (vanilla, responsive)
   ===================================================================== */

:root {
  --bg:        #0f1226;
  --bg-2:      #171a35;
  --carte:     #1e2242;
  --carte-2:   #262b52;
  --texte:     #eef0ff;
  --texte-dim: #a8adcf;
  --primaire:  #6c5ce7;
  --primaire-2:#8a7bff;
  --accent:    #00d1b2;
  --vert:      #2ecc71;
  --rouge:     #ff5470;
  --or:        #ffd166;
  --radius:    16px;
  --ombre:     0 10px 30px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 800px at 50% -10%, #23285a 0%, var(--bg) 55%) fixed;
  color: var(--texte);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px) clamp(14px, 4vw, 24px) 48px;
  min-height: 100vh;
}

/* --- Écrans (une seule visible à la fois) --- */
.ecran { display: none; animation: fade .3s ease; }
.ecran.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* --- En-têtes --- */
.hero { text-align: center; margin: 8px 0 22px; }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); margin: 0 0 6px; letter-spacing: -.5px; }
.soustitre { color: var(--texte-dim); margin: 0; }

/* --- Cartes --- */
.carte {
  background: linear-gradient(180deg, var(--carte) 0%, var(--carte-2) 100%);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  box-shadow: var(--ombre);
  padding: 20px;
  margin: 0 0 18px;
}

/* --- Formulaire accueil --- */
label { display: block; font-weight: 600; margin-bottom: 8px; }
input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  font-size: 1.05rem;
  color: var(--texte);
  background: #0d1030;
  border: 1.5px solid #343a6b;
  border-radius: 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus {
  border-color: var(--primaire-2);
  box-shadow: 0 0 0 3px rgba(108,92,231,.25);
}

/* --- Boutons --- */
.btn {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 12px;
  transition: transform .05s ease, filter .15s ease, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primaire {
  color: #fff;
  background: linear-gradient(135deg, var(--primaire) 0%, var(--primaire-2) 100%);
}
.btn-primaire:hover { filter: brightness(1.08); }
.btn-secondaire {
  color: var(--texte);
  background: #333a6e;
}
.btn-secondaire:hover { filter: brightness(1.12); }
.btn-lien {
  background: transparent;
  color: var(--texte-dim);
  font-weight: 600;
  text-decoration: underline;
}
.actions { display: flex; gap: 12px; }
.actions .btn { margin-top: 14px; }

.regles {
  color: var(--texte-dim);
  font-size: .92rem;
  text-align: center;
  margin-top: 18px;
}

.message.erreur { color: var(--rouge); font-size: .9rem; margin: 8px 0 0; }

/* --- Barre du haut (jeu) --- */
.barre-haut {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .95rem;
  color: var(--texte-dim);
  margin-bottom: 12px;
}
.score-courant strong { color: var(--accent); font-size: 1.1rem; }

/* --- Chrono --- */
.chrono-wrap {
  height: 12px;
  background: #0d1030;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #2a2f5c;
}
.chrono-barre {
  height: 100%;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--primaire-2));
  transition: width .1s linear, background .3s;
}
.chrono-barre.alerte { background: linear-gradient(90deg, var(--rouge), #ff8fa3); }
.chrono-txt { text-align: right; color: var(--texte-dim); font-size: .85rem; margin: 4px 2px 14px; }

/* --- Carte question --- */
.carte-question { text-align: center; }
.badge {
  display: inline-block;
  background: rgba(0,209,178,.15);
  color: var(--accent);
  border: 1px solid rgba(0,209,178,.35);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 14px;
}
.citation {
  font-size: clamp(1.25rem, 4.5vw, 1.7rem);
  font-weight: 600;
  font-style: italic;
  margin: 8px 0 4px;
  line-height: 1.35;
}
.citation::before { content: "« "; opacity: .5; }
.citation::after  { content: " »"; opacity: .5; }

/* --- Zone réponse --- */
.zone-reponse { margin-bottom: 8px; }

/* --- Feedback --- */
.feedback {
  text-align: center;
  padding: 18px;
  border-radius: var(--radius);
  margin-top: 6px;
  animation: fade .25s ease;
}
.feedback.bon   { background: rgba(46,204,113,.12); border: 1px solid rgba(46,204,113,.4); }
.feedback.mauvais { background: rgba(255,84,112,.12); border: 1px solid rgba(255,84,112,.4); }
.verdict { font-size: 1.3rem; font-weight: 800; margin: 0 0 6px; }
.feedback.bon .verdict { color: var(--vert); }
.feedback.mauvais .verdict { color: var(--rouge); }
.reveal { margin: 0 0 6px; color: var(--texte); }
.reveal strong { color: var(--or); }

/* --- Écran fin : récap --- */
.recap-tete { display: flex; justify-content: space-around; text-align: center; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat-val { font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-lbl { font-size: .8rem; color: var(--texte-dim); }

.titre-section { text-align: center; margin: 22px 0 2px; font-size: 1.2rem; }
.sous-info { text-align: center; color: var(--texte-dim); margin: 0 0 10px; font-size: .88rem; }

/* --- Classement --- */
.classement { list-style: none; padding: 0; margin: 0 0 18px; counter-reset: rang; }
.classement li {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--carte);
  border: 1px solid rgba(255,255,255,.05);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.classement li .rang {
  min-width: 30px;
  font-weight: 800;
  color: var(--texte-dim);
  text-align: center;
}
.classement li:nth-child(1) .rang { color: var(--or); }
.classement li:nth-child(2) .rang { color: #cfd3ee; }
.classement li:nth-child(3) .rang { color: #e0a06a; }
.classement li .nom { flex: 1; font-weight: 700; overflow-wrap: anywhere; }
.classement li .pts { color: var(--accent); font-weight: 800; }
.classement li .tps { color: var(--texte-dim); font-size: .82rem; min-width: 64px; text-align: right; }
.classement li.moi { border-color: var(--primaire-2); box-shadow: 0 0 0 2px rgba(138,123,255,.35); }
.classement .vide { justify-content: center; color: var(--texte-dim); }

/* --- Détail réponses --- */
.detail-reponses { margin-top: 18px; }
.detail-reponses summary { cursor: pointer; color: var(--texte-dim); font-weight: 600; }
.detail-liste { list-style: none; padding: 0; margin: 12px 0 0; }
.detail-liste li {
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  background: var(--carte);
  border-left: 4px solid var(--rouge);
  font-size: .9rem;
}
.detail-liste li.ok { border-left-color: var(--vert); }
.detail-liste .d-cite { color: var(--texte-dim); font-style: italic; }
.detail-liste .d-rep { display: block; margin-top: 3px; }
.detail-liste .d-rep strong { color: var(--or); }

/* --- Divers --- */
[hidden] { display: none !important; }

@media (max-width: 380px) {
  .recap-tete { flex-wrap: wrap; gap: 14px; }
  .stat { min-width: 40%; }
}
