/* ===================================================================
   PsyQuiz — feuille de style professionnelle
   Palette académique : indigo / ardoise, titres serif, cartes épurées
   =================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6f9;
  --card: #ffffff;
  --ink: #18223a;
  --ink-soft: #36415c;
  --muted: #6a7488;
  --faint: #9aa3b5;
  --line: #e7e9f0;
  --line-strong: #d7dae6;

  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef0fe;

  --green: #0c9b6a;
  --green-bg: #e8f7f0;
  --red: #d83a4a;
  --red-bg: #fdedef;
  --amber: #c9820a;
  --amber-bg: #fdf4e3;

  --shadow-sm: 0 1px 2px rgba(24, 34, 58, .05), 0 1px 3px rgba(24, 34, 58, .04);
  --shadow: 0 6px 20px rgba(24, 34, 58, .07);
  --shadow-lg: 0 16px 40px rgba(24, 34, 58, .12);

  --radius: 16px;
  --radius-sm: 11px;
  --serif: Georgia, "Times New Roman", serif;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 520px at 50% -8%, #e9ecf6 0%, rgba(233, 236, 246, 0) 70%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; }

.view { max-width: 940px; margin: 0 auto; padding: 32px 22px 72px; }
.hidden { display: none !important; }

/* ====== En-tête / accueil ====== */
.hero { text-align: center; margin-bottom: 34px; }
.kicker {
  display: inline-block; font-family: "Segoe UI", sans-serif;
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft);
  padding: 5px 13px; border-radius: 999px; margin-bottom: 14px;
}
.hero h1 { font-size: 2.55rem; }
.hero .brain { display: inline-block; animation: float 3.4s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.subtitle { color: var(--muted); margin-top: 8px; font-size: 1.02rem; }

.section-title {
  font-size: 1.16rem; margin: 30px 0 14px; color: var(--ink);
  display: flex; align-items: center; gap: 9px;
}
.section-title .st-emoji { font-size: 1.1rem; }

/* ====== Sélecteur de niveau ====== */
.level-switch {
  display: flex; gap: 4px; padding: 5px; width: fit-content;
  background: #eceef5; border: 1px solid var(--line); border-radius: 999px;
  margin: 0 auto 10px;
}
.level-opt {
  border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: .9rem; font-weight: 700; color: var(--muted);
  padding: 9px 20px; border-radius: 999px; transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.level-opt:hover { color: var(--ink); }
.level-opt.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow-sm); }
.level-opt[data-level="difficile"].active { color: #c2410c; }
.level-hint { text-align: center; color: var(--muted); font-size: .85rem; margin-bottom: 18px; max-width: 640px; margin-left: auto; margin-right: auto; }

.chapter-card.empty { opacity: .6; cursor: not-allowed; }
.chapter-card.empty::before { background: var(--line-strong); }

/* ====== Boutons de mode ====== */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mode-btn {
  position: relative; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); font-family: inherit; color: var(--ink);
  display: flex; flex-direction: column; gap: 9px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.mode-btn:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.mode-btn:disabled { opacity: .5; cursor: not-allowed; }
.mode-tile {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
  font-size: 1.4rem; background: var(--primary-soft);
}
.mode-label { font-weight: 700; font-size: 1.06rem; font-family: var(--serif); }
.mode-desc { font-size: .85rem; color: var(--muted); }

/* bouton principal : examen blanc */
.mode-btn.primary { background: linear-gradient(160deg, #4f46e5 0%, #5b54ea 100%); border-color: transparent; color: #fff; }
.mode-btn.primary .mode-tile { background: rgba(255, 255, 255, .16); }
.mode-btn.primary .mode-desc { color: rgba(255, 255, 255, .85); }
.mode-btn.primary:hover:not(:disabled) { box-shadow: 0 14px 30px rgba(79, 70, 229, .32); }
.mode-flag {
  position: absolute; top: 14px; right: 14px; font-size: .66rem; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  background: rgba(255, 255, 255, .18); color: #fff; padding: 3px 9px; border-radius: 999px;
}

/* ====== Cartes de chapitre ====== */
.chapter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.chapter-card {
  position: relative; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; cursor: pointer; text-align: left; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 10px; font-family: inherit; color: inherit;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.chapter-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--accent, var(--primary));
}
.chapter-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.chapter-top { display: flex; align-items: center; gap: 12px; }
.chapter-emoji {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  font-size: 1.5rem; background: color-mix(in srgb, var(--accent, var(--primary)) 12%, #fff); flex-shrink: 0;
}
.chapter-name { font-weight: 700; font-size: 1.04rem; line-height: 1.3; font-family: var(--serif); }
.chapter-meta { color: var(--muted); font-size: .82rem; }
.chapter-stats { display: flex; flex-direction: column; gap: 7px; margin-top: 2px; }
.stat-row { display: flex; align-items: center; gap: 9px; font-size: .77rem; color: var(--muted); }
.stat-row .stat-label { width: 74px; flex-shrink: 0; }
.stat-row .progress-track { flex: 1; }
.stat-row .stat-val { width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.badge {
  align-self: flex-start; font-size: .74rem; font-weight: 700;
  background: var(--green-bg); color: var(--green);
  padding: 4px 11px; border-radius: 999px;
}

.progress-track { display: block; background: #edeef4; border-radius: 999px; height: 7px; overflow: hidden; }
.progress-fill { display: block; background: var(--primary); height: 100%; border-radius: 999px; width: 0; transition: width .45s ease; }
.progress-fill.good { background: var(--green); }
.progress-fill.mid { background: var(--amber); }
.progress-fill.bad { background: var(--red); }

/* ====== Panneau notions faibles ====== */
.weak-hint { color: var(--muted); font-size: .88rem; margin-bottom: 12px; }
.notion-list { display: flex; flex-direction: column; gap: 9px; }
.notion-row {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 1fr 120px 50px; align-items: center; gap: 14px;
}
.notion-name { font-size: .92rem; font-weight: 600; }
.notion-sub { display: block; font-weight: 400; font-size: .75rem; color: var(--faint); margin-top: 1px; }
.notion-pct { font-weight: 700; font-size: .95rem; text-align: right; font-variant-numeric: tabular-nums; }
.notion-pct.good { color: var(--green); }
.notion-pct.mid { color: var(--amber); }
.notion-pct.bad { color: var(--red); }

.footer { margin-top: 50px; text-align: center; color: var(--faint); font-size: .8rem; }
.footer p { line-height: 1.6; }
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; margin-top: 10px; font-size: .8rem; font-family: inherit; }
.link-btn:hover { color: var(--red); }

/* ====== Quiz ====== */
.quiz-header { display: flex; align-items: center; gap: 14px; margin-bottom: 24px; }
.icon-btn {
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  width: 42px; height: 42px; font-size: 1.05rem; cursor: pointer;
  box-shadow: var(--shadow-sm); color: var(--muted); flex-shrink: 0; font-family: inherit;
}
.icon-btn:hover { color: var(--red); border-color: var(--line-strong); }
.quiz-progress-wrap { flex: 1; min-width: 0; }
.quiz-title-row { display: flex; justify-content: space-between; margin-bottom: 7px; gap: 8px; }
.quiz-title { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-counter { color: var(--muted); font-size: .85rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: 8px; flex-shrink: 0; }
.chip {
  background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px;
  font-size: .85rem; font-weight: 700; box-shadow: var(--shadow-sm); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.chip.streak.hot { background: var(--amber-bg); border-color: #f1dcae; animation: pulse .55s ease; }
.chip.timer { color: var(--ink-soft); }
.chip.timer.urgent { background: var(--red-bg); border-color: #f3c2c8; color: var(--red); animation: pulse .55s ease infinite; }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }

.question-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: var(--shadow); animation: slideIn .28s ease;
}
@keyframes slideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.notion-tag {
  display: inline-block; font-size: .74rem; font-weight: 700;
  background: var(--primary-soft); color: var(--primary);
  padding: 4px 12px; border-radius: 999px;
}
.type-tag {
  display: inline-block; font-size: .74rem; font-weight: 700;
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted);
}
.type-tag.cas { background: #fff4ec; border-color: #f4d3bd; color: #c4632a; }
.type-tag.vf { background: #eef6ff; border-color: #cfe2f7; color: #2f6fb0; }

.question-text { font-size: 1.24rem; line-height: 1.5; margin-bottom: 22px; font-family: var(--serif); }

.options { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  position: relative;
  background: #fafbfd; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 14px 18px 14px 48px; font-size: 1rem; text-align: left; cursor: pointer;
  font-family: inherit; color: var(--ink); line-height: 1.45;
  transition: border-color .14s ease, background .14s ease, transform .1s ease;
}
.option-btn::before {
  content: attr(data-key); position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 6px; background: #fff; border: 1px solid var(--line-strong);
  display: grid; place-items: center; font-size: .76rem; font-weight: 700; color: var(--muted);
}
.option-btn:hover:not(:disabled) { border-color: var(--primary); background: var(--primary-soft); }
.option-btn:disabled { cursor: default; }
.option-btn.selected { border-color: var(--primary); background: var(--primary-soft); }
.option-btn.selected::before { background: var(--primary); border-color: var(--primary); color: #fff; }
.option-btn.correct { background: var(--green-bg); border-color: var(--green); font-weight: 600; }
.option-btn.correct::before { background: var(--green); border-color: var(--green); color: #fff; content: "✓"; }
.option-btn.wrong { background: var(--red-bg); border-color: var(--red); animation: shake .34s ease; }
.option-btn.wrong::before { background: var(--red); border-color: var(--red); color: #fff; content: "✕"; }
.option-btn.dimmed { opacity: .5; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.feedback { margin-top: 18px; border-radius: var(--radius-sm); padding: 15px 18px; animation: slideIn .22s ease; border: 1px solid transparent; }
.feedback.ok { background: var(--green-bg); border-color: #bfe8d6; }
.feedback.ko { background: var(--red-bg); border-color: #f3c8ce; }
.feedback-msg { font-weight: 800; margin-bottom: 6px; font-family: var(--serif); }
.feedback.ok .feedback-msg { color: var(--green); }
.feedback.ko .feedback-msg { color: var(--red); }
.feedback-expl { font-size: .93rem; line-height: 1.55; color: var(--ink-soft); }

.primary-btn {
  background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 14px 26px; font-size: 1rem; font-weight: 700; cursor: pointer; margin-top: 18px;
  font-family: inherit; transition: background .15s ease, transform .1s ease, box-shadow .15s ease;
}
.primary-btn:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(79, 70, 229, .25); }
.secondary-btn {
  background: var(--card); color: var(--primary); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 12px 22px; font-size: .95rem; font-weight: 700;
  cursor: pointer; font-family: inherit; transition: border-color .15s ease, background .15s ease;
}
.secondary-btn:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ====== Résultats ====== */
.results-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 34px 30px; box-shadow: var(--shadow); text-align: center; animation: slideIn .28s ease;
}
.verdict {
  display: inline-block; font-size: .8rem; font-weight: 800; letter-spacing: .04em;
  padding: 7px 16px; border-radius: 999px; margin-bottom: 14px; text-transform: uppercase;
}
.verdict.pass { background: var(--green-bg); color: var(--green); border: 1px solid #bfe8d6; }
.verdict.fail { background: var(--amber-bg); color: var(--amber); border: 1px solid #f1dcae; }
.results-title { font-size: 1.7rem; margin-bottom: 18px; }
.ring-wrap { position: relative; width: 176px; height: 176px; margin: 0 auto 14px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #edeef4; stroke-width: 10; }
.ring-fg {
  fill: none; stroke: var(--primary); stroke-width: 10; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1s ease;
}
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-percent { font-size: 2.3rem; font-weight: 800; font-family: var(--serif); }
.ring-detail { color: var(--muted); font-size: .9rem; }
.results-streak, .results-time { color: var(--muted); margin-bottom: 4px; font-size: .92rem; }
.results-time strong { color: var(--ink); }
.results-card .section-title { text-align: left; }
.results-card .notion-list { text-align: left; }

.weak-callout {
  background: #fffaf1; border: 1px solid #f1dcae; border-radius: var(--radius-sm);
  padding: 17px 20px; margin-top: 22px; text-align: left;
}
.weak-callout h3 { font-size: 1rem; margin-bottom: 9px; }
.weak-callout ul { padding-left: 20px; }
.weak-callout li { font-size: .92rem; margin-bottom: 5px; line-height: 1.45; }

/* correction détaillée (examen) */
.review-list { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.review-card {
  background: #fafbfd; border: 1px solid var(--line); border-left: 4px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 15px 18px;
}
.review-card.ok { border-left-color: var(--green); }
.review-card.ko { border-left-color: var(--red); }
.review-card.skipped { border-left-color: var(--faint); }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.review-num {
  width: 24px; height: 24px; border-radius: 7px; background: #eceef4; color: var(--muted);
  display: grid; place-items: center; font-size: .78rem; font-weight: 700; flex-shrink: 0;
}
.review-meta { flex: 1; font-size: .76rem; color: var(--muted); font-weight: 600; }
.review-mark { font-weight: 800; font-size: 1rem; }
.review-card.ok .review-mark { color: var(--green); }
.review-card.ko .review-mark { color: var(--red); }
.review-card.skipped .review-mark { color: var(--faint); }
.review-q { font-size: .96rem; font-weight: 600; margin-bottom: 9px; line-height: 1.45; }
.review-line { font-size: .9rem; margin-bottom: 4px; line-height: 1.45; }
.review-line.ok { color: var(--green); font-weight: 600; }
.review-line.ko { color: var(--red); }
.review-expl { font-size: .88rem; color: var(--muted); margin-top: 7px; line-height: 1.5; padding-top: 7px; border-top: 1px dashed var(--line-strong); }

.results-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }

/* ====== Confettis ====== */
.confetti { position: fixed; top: -14px; border-radius: 2px; z-index: 999; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(106vh) rotate(720deg); opacity: .6; } }

/* ====== Sections de modes (accueil) ====== */
.mode-section { margin-bottom: 8px; }
.modes-3 { grid-template-columns: repeat(3, 1fr); }
.modes-2 { grid-template-columns: repeat(2, 1fr); }
.mode-btn.game { background: linear-gradient(150deg, #f0635c 0%, #f4a259 100%); border-color: transparent; color: #fff; }
.mode-btn.game .mode-tile { background: rgba(255, 255, 255, .18); }
.mode-btn.game .mode-desc { color: rgba(255, 255, 255, .9); }
.mode-btn.game:hover:not(:disabled) { box-shadow: 0 14px 30px rgba(240, 99, 92, .32); }

/* ====== Format : choix multiples ====== */
.multi-hint { font-size: .85rem; color: var(--muted); margin-bottom: 12px; }
.option-btn.multi::before { border-radius: 6px; content: ""; }
.option-btn.multi.selected::before { content: "✓"; }
.option-btn.missed { border-color: var(--green); background: #eafaf2; }
.option-btn.missed::before { content: "+"; background: var(--green); border-color: var(--green); color: #fff; }

/* ====== Format : réponse à écrire ====== */
.saisie-wrap { margin-top: 4px; }
.saisie-input {
  width: 100%; padding: 15px 18px; font-size: 1.05rem; font-family: inherit; color: var(--ink);
  background: #fafbfd; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
  transition: border-color .15s ease, background .15s ease;
}
.saisie-input:focus { outline: none; border-color: var(--primary); background: #fff; }
.saisie-input.correct { border-color: var(--green); background: var(--green-bg); }
.saisie-input.wrong { border-color: var(--red); background: var(--red-bg); }

/* type-tags supplémentaires */
.type-tag.multi { background: #eef0fe; border-color: #d3d8fb; color: #4f46e5; }
.type-tag.saisie { background: #eafaf2; border-color: #bfe8d6; color: #0c9b6a; }

/* ====== Format : association (match) ====== */
.options.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  position: relative; text-align: left; padding: 12px 32px 12px 14px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fafbfd;
  font-family: inherit; font-size: .9rem; color: var(--ink); line-height: 1.35; cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.match-item:hover:not(:disabled) { border-color: var(--primary); }
.match-item.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft); }
.match-item.paired { font-weight: 600; }
.match-item:not([data-num=""])::after {
  content: attr(data-num); position: absolute; top: 8px; right: 8px; width: 18px; height: 18px;
  border-radius: 50%; font-size: .7rem; font-weight: 800; display: grid; place-items: center; color: #fff; background: var(--muted);
}
.match-item.pair-1 { border-color: #4f46e5; background: #eef0fe; } .match-item.pair-1::after { background: #4f46e5; }
.match-item.pair-2 { border-color: #0c9b6a; background: #e8f7f0; } .match-item.pair-2::after { background: #0c9b6a; }
.match-item.pair-3 { border-color: #c9820a; background: #fdf4e3; } .match-item.pair-3::after { background: #c9820a; }
.match-item.pair-4 { border-color: #c44d9b; background: #fbeef6; } .match-item.pair-4::after { background: #c44d9b; }
.match-item.correct { border-color: var(--green) !important; background: var(--green-bg) !important; }
.match-item.wrong { border-color: var(--red) !important; background: var(--red-bg) !important; }

/* ====== Format : remise en ordre (ordre) ====== */
.options.ordre-list { display: flex; flex-direction: column; gap: 9px; }
.ordre-item {
  position: relative; text-align: left; padding: 14px 16px 14px 52px;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm); background: #fafbfd;
  font-family: inherit; font-size: 1rem; color: var(--ink); cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.ordre-item:hover:not(:disabled) { border-color: var(--primary); }
.ordre-item::before {
  content: attr(data-num); position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 8px; background: #eceef4; color: var(--muted);
  display: grid; place-items: center; font-weight: 800; font-size: .82rem;
}
.ordre-item.chosen { border-color: var(--primary); background: var(--primary-soft); }
.ordre-item.chosen::before { background: var(--primary); color: #fff; }
.ordre-item.correct { border-color: var(--green); background: var(--green-bg); }
.ordre-item.correct::before { background: var(--green); color: #fff; }
.ordre-item.wrong { border-color: var(--red); background: var(--red-bg); }
.ordre-item.wrong::before { background: var(--red); color: #fff; }

/* ====== Flashcards (Mémo) ====== */
.flash-stage { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.flashcard {
  width: 100%; max-width: 560px; min-height: 300px; cursor: pointer;
  perspective: 1400px; position: relative;
}
.flash-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; transition: transform .55s cubic-bezier(.4, .1, .25, 1);
}
.flash-front { background: var(--card); transform: rotateY(0deg); }
.flash-back { background: linear-gradient(160deg, #f3f1ff 0%, #eafaf2 100%); transform: rotateY(180deg); }
.flashcard.flipped .flash-front { transform: rotateY(-180deg); }
.flashcard.flipped .flash-back { transform: rotateY(0deg); }
.flash-tag { font-size: .76rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 4px 12px; border-radius: 999px; margin-bottom: 16px; }
.flash-q { font-family: var(--serif); font-size: 1.3rem; line-height: 1.45; }
.flash-hint { position: absolute; bottom: 16px; font-size: .78rem; color: var(--faint); }
.flash-label { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--green); margin-bottom: 12px; }
.flash-a { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; line-height: 1.4; margin-bottom: 14px; }
.flash-expl { font-size: .92rem; line-height: 1.55; color: var(--ink-soft); }
.flash-rate { width: 100%; max-width: 560px; text-align: center; animation: slideIn .25s ease; }
.flash-rate-q { color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.flash-rate-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rate-btn { border: 1.5px solid var(--line-strong); background: var(--card); border-radius: var(--radius-sm); padding: 13px 8px; font-family: inherit; font-size: .92rem; font-weight: 700; cursor: pointer; transition: transform .1s ease, border-color .15s ease, background .15s ease; }
.rate-btn:hover { transform: translateY(-2px); }
.rate-ko:hover { border-color: var(--red); background: var(--red-bg); }
.rate-mid:hover { border-color: var(--amber); background: var(--amber-bg); }
.rate-ok:hover { border-color: var(--green); background: var(--green-bg); }
.flash-over-text { color: var(--ink-soft); font-size: 1rem; line-height: 1.6; margin-bottom: 8px; }

/* ====== Défi Éclair (jeu) ====== */
.game-hud { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.game-stat { display: flex; flex-direction: column; line-height: 1.1; }
.gs-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.gs-val { font-size: 1.3rem; font-weight: 800; font-family: var(--serif); font-variant-numeric: tabular-nums; }
.gs-val.combo { color: var(--primary); transition: transform .15s ease; }
.gs-val.combo.bump { animation: comboBump .4s ease; }
@keyframes comboBump { 0% { transform: scale(1); } 40% { transform: scale(1.45); color: var(--orange); } 100% { transform: scale(1); } }
.game-lives { margin-left: auto; font-size: 1.2rem; letter-spacing: 2px; }
.game-lives .life-lost { opacity: .25; filter: grayscale(1); }
.game-timerbar { height: 8px; background: #edeef4; border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.game-timerfill { height: 100%; width: 100%; background: linear-gradient(90deg, #0c9b6a, #c9820a, #d83a4a); border-radius: 999px; }
.game-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); animation: popIn .25s ease; }
.game-card.flash-ok { animation: flashOk .4s ease; }
.game-card.flash-ko { animation: shake .4s ease; }
@keyframes popIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
@keyframes flashOk { 0% { box-shadow: 0 0 0 0 rgba(12, 155, 106, 0); } 40% { box-shadow: 0 0 0 5px rgba(12, 155, 106, .35); } 100% { box-shadow: var(--shadow); } }
.game-popup { position: fixed; left: 50%; top: 38%; transform: translateX(-50%); pointer-events: none; z-index: 50; font-family: var(--serif); font-weight: 800; font-size: 2.4rem; opacity: 0; }
.game-popup.show { animation: floatUp 1s ease forwards; }
.game-popup.good { color: var(--green); }
.game-popup.bad { color: var(--red); font-size: 1.6rem; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); } 25% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.game-final { margin: 8px 0 6px; }
.game-final-score { font-family: var(--serif); font-size: 3rem; font-weight: 800; color: var(--primary); }
.gf-label { display: block; color: var(--muted); font-size: .9rem; }
.game-best { color: var(--amber); font-weight: 700; margin-bottom: 6px; }
.game-recap { color: var(--muted); font-size: .92rem; }

/* ====== Responsive ====== */
@media (max-width: 720px) {
  .modes, .modes-2, .modes-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .hero h1 { font-size: 2rem; }
  .view { padding: 24px 16px 60px; }
  .notion-row { grid-template-columns: 1fr 64px 46px; gap: 10px; }
  .chips { gap: 6px; }
  .chip { padding: 6px 10px; font-size: .78rem; }
  .question-text { font-size: 1.12rem; }
  .question-card { padding: 22px 18px; }
  .results-card { padding: 26px 18px; }
}
