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

:root {
  --navy: #0F1C2E;
  --navy2: #1E2B3A;
  --navy3: #243447;
  --teal: #4ECDC4;
  --teal2: #6BC7BA;
  --orange: #FF6B35;
  --orange2: #FF8C42;
  --white: #F8FAFC;
  --grey: #8B9BB4;
  --success: #2ECC71;
  --error: #E74C3C;
  --card-bg: #1A2740;
  --border: rgba(78,205,196,0.15);
}

body { font-family: 'Inter', sans-serif; background: var(--navy); color: var(--white); min-height: 100vh; }

.hidden { display: none !important; }

/* ── NAVBAR ── */
.navbar { background: rgba(15,28,46,0.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; }
.nav-inner { max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-size: 1.4rem; font-weight: 800; color: var(--white); text-decoration: none; letter-spacing: -0.5px; }
.nav-logo span { color: var(--teal); }
.nav-links { display: flex; gap: 32px; }
.nav-links a { color: var(--grey); text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--teal); }

/* ── HERO ── */
.hero { max-width: 1200px; margin: 0 auto; padding: 80px 24px 60px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 40px; }
.hero-content h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 800; line-height: 1.15; letter-spacing: -1px; margin-bottom: 16px; }
.hero-content h1 .accent { color: var(--teal); }
.hero-content p { font-size: 1.15rem; color: var(--grey); margin-bottom: 32px; }
.hero-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 24px 36px; text-align: center; }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--teal); }
.stat-label { font-size: 0.85rem; color: var(--grey); margin-top: 4px; }

/* ── BUTTONS ── */
.btn-primary { background: linear-gradient(135deg, var(--teal), var(--teal2)); color: var(--navy); font-weight: 700; font-size: 1rem; padding: 14px 28px; border: none; border-radius: 50px; cursor: pointer; transition: transform .2s, box-shadow .2s; box-shadow: 0 4px 20px rgba(78,205,196,0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(78,205,196,0.45); }
.btn-secondary { background: transparent; color: var(--teal); font-weight: 600; font-size: 1rem; padding: 14px 28px; border: 2px solid var(--teal); border-radius: 50px; cursor: pointer; transition: all .2s; }
.btn-secondary:hover { background: rgba(78,205,196,0.1); }
.btn-secondary.small { padding: 10px 20px; font-size: 0.9rem; }

/* ── SECTION TITLE ── */
.section-title { max-width: 1200px; margin: 0 auto; padding: 0 24px; margin-bottom: 32px; }
.section-title h2 { font-size: 1.8rem; font-weight: 700; }
.section-title p { color: var(--grey); margin-top: 8px; }

/* ── SEANCES GRID ── */
.seances-grid, .seances-grid-full { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.seance-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 24px 20px; cursor: pointer; transition: all .25s; text-align: center; position: relative; overflow: hidden; }
.seance-card::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(78,205,196,0.06), transparent); opacity: 0; transition: opacity .25s; }
.seance-card:hover { transform: translateY(-4px); border-color: var(--teal); box-shadow: 0 12px 40px rgba(78,205,196,0.2); }
.seance-card:hover::before { opacity: 1; }
.seance-num { font-size: 2rem; font-weight: 800; color: var(--teal); }
.seance-name { font-size: 0.9rem; font-weight: 600; margin: 4px 0; }
.seance-count { font-size: 0.8rem; color: var(--grey); }
.seance-progress-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-top: 16px; overflow: hidden; }
.seance-progress-fill { height: 100%; background: var(--teal); border-radius: 2px; transition: width .4s; }
.seance-score-badge { position: absolute; top: 12px; right: 12px; background: var(--success); color: #fff; font-size: 0.7rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; }

/* ── STEPS ── */
.steps-grid { max-width: 1200px; margin: 0 auto; padding: 0 24px 80px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 24px; }
.step-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 28px; }
.step-icon { font-size: 2rem; margin-bottom: 12px; }
.step-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step-card p { font-size: 0.88rem; color: var(--grey); line-height: 1.6; }

/* ── PAGE HEADER ── */
.page-header { max-width: 1200px; margin: 0 auto; padding: 32px 24px 24px; display: flex; align-items: center; gap: 16px; }
.page-header h2 { font-size: 1.6rem; font-weight: 700; flex: 1; }
.back-btn { background: rgba(255,255,255,0.08); border: none; color: var(--white); padding: 10px 18px; border-radius: 50px; cursor: pointer; font-size: 0.9rem; font-weight: 500; transition: background .2s; }
.back-btn:hover { background: rgba(255,255,255,0.14); }

/* ── EXAM HEADER ── */
.exam-header { background: var(--navy2); border-bottom: 1px solid var(--border); padding: 0 24px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.exam-info { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.exam-info span:first-child { font-weight: 700; font-size: 1rem; }
.exam-info span:last-child { font-size: 0.8rem; color: var(--grey); }

/* ── TIMER ── */
.timer-wrap { position: relative; width: 52px; height: 52px; }
.timer-svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.timer-bg { fill: none; stroke: rgba(255,255,255,0.1); stroke-width: 3; }
.timer-fg { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer-fg.urgent { stroke: var(--error); }
.timer-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 700; }

/* ── PROGRESS BAR ── */
.progress-bar-wrap { height: 4px; background: rgba(255,255,255,0.06); }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--teal), var(--teal2)); transition: width .4s; }
.progress-dots { max-width: 900px; margin: 12px auto; padding: 0 24px; display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,0.1); border: 2px solid transparent; transition: all .3s; flex-shrink: 0; }
.dot.current { border-color: var(--teal); background: transparent; }
.dot.correct { background: var(--success); }
.dot.wrong { background: var(--error); }
.dot.skipped { background: var(--orange); }
.dot.answered { background: rgba(255,255,255,0.4); }

/* ── EXAM BODY ── */
.exam-body { max-width: 760px; margin: 0 auto; padding: 24px; }
.question-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; margin-bottom: 20px; }
.question-image-wrap { background: var(--navy2); display: flex; align-items: center; justify-content: center; min-height: 240px; }
.question-image { max-width: 100%; max-height: 360px; object-fit: contain; display: block; }
.question-controls { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px 0; }
.audio-btn { background: rgba(78,205,196,0.12); border: 1px solid var(--border); color: var(--teal); width: 42px; height: 42px; border-radius: 50%; cursor: pointer; font-size: 1.1rem; transition: all .2s; display: flex; align-items: center; justify-content: center; }
.audio-btn:hover { background: rgba(78,205,196,0.25); }
.audio-btn.playing { background: var(--teal); color: var(--navy); }
.question-text { font-size: 1.1rem; font-weight: 600; line-height: 1.6; padding: 16px 24px; }
.answers { padding: 0 20px; display: flex; flex-direction: column; gap: 10px; }
.answer-btn { background: rgba(255,255,255,0.04); border: 2px solid rgba(255,255,255,0.08); color: var(--white); text-align: left; padding: 14px 20px; border-radius: 12px; cursor: pointer; font-size: 0.95rem; font-family: inherit; transition: all .2s; display: flex; align-items: center; gap: 14px; }
.answer-btn:hover:not(:disabled) { border-color: var(--teal); background: rgba(78,205,196,0.08); }
.answer-btn.selected { border-color: var(--teal); background: rgba(78,205,196,0.15); }
.answer-btn.correct { border-color: var(--success); background: rgba(46,204,113,0.15); color: var(--success); }
.answer-btn.wrong { border-color: var(--error); background: rgba(231,76,60,0.15); color: var(--error); }
.answer-letter { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.08); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.9rem; flex-shrink: 0; transition: all .2s; }
.answer-btn.selected .answer-letter { background: var(--teal); color: var(--navy); }
.answer-btn.correct .answer-letter { background: var(--success); color: #fff; }
.answer-btn.wrong .answer-letter { background: var(--error); color: #fff; }
.validate-wrap { padding: 20px; display: flex; justify-content: center; }
.btn-validate { background: linear-gradient(135deg, var(--teal), var(--teal2)); color: var(--navy); font-weight: 700; font-size: 1rem; padding: 14px 48px; border: none; border-radius: 50px; cursor: pointer; transition: all .2s; box-shadow: 0 4px 20px rgba(78,205,196,0.3); }
.btn-validate:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn-validate:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(78,205,196,0.45); }

/* ── EXPLANATION ── */
.explanation-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; padding: 28px; }
.explanation-result { font-size: 1.3rem; font-weight: 700; margin-bottom: 12px; }
.explanation-result.ok { color: var(--success); }
.explanation-result.ko { color: var(--error); }
.explanation-text { font-size: 0.95rem; color: var(--grey); line-height: 1.7; margin-bottom: 24px; white-space: pre-line; }
.btn-suivant { background: var(--orange); color: #fff; font-weight: 700; font-size: 1rem; padding: 14px 36px; border: none; border-radius: 50px; cursor: pointer; transition: all .2s; width: 100%; }
.btn-suivant:hover { background: var(--orange2); transform: translateY(-1px); }

/* ── RESULTS ── */
.results-wrap { max-width: 800px; margin: 0 auto; padding: 40px 24px 80px; }
.results-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 24px; padding: 40px; text-align: center; margin-bottom: 32px; }
.results-icon { font-size: 4rem; margin-bottom: 16px; }
.results-card h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 24px; }
.score-circle { background: var(--navy); border: 3px solid var(--teal); border-radius: 50%; width: 160px; height: 160px; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto 24px; }
.score-num { font-size: 2.2rem; font-weight: 800; color: var(--teal); }
.score-pct { font-size: 1rem; color: var(--grey); }
.results-status { font-size: 1.2rem; font-weight: 700; padding: 12px 28px; border-radius: 50px; display: inline-block; margin-bottom: 28px; }
.results-status.pass { background: rgba(46,204,113,0.15); color: var(--success); border: 1px solid rgba(46,204,113,0.3); }
.results-status.fail { background: rgba(231,76,60,0.15); color: var(--error); border: 1px solid rgba(231,76,60,0.3); }
.results-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.review-section h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; }
.review-item { background: var(--card-bg); border: 1px solid rgba(231,76,60,0.2); border-radius: 16px; padding: 20px; margin-bottom: 16px; }
.review-item .rv-q { font-weight: 600; font-size: 0.95rem; margin-bottom: 12px; }
.review-item img { max-width: 100%; border-radius: 10px; margin-bottom: 12px; max-height: 200px; object-fit: contain; background: var(--navy2); }
.review-item .rv-given { color: var(--error); font-size: 0.9rem; margin-bottom: 4px; }
.review-item .rv-correct { color: var(--success); font-size: 0.9rem; margin-bottom: 10px; }
.review-item .rv-expl { color: var(--grey); font-size: 0.85rem; line-height: 1.6; padding-top: 10px; border-top: 1px solid var(--border); white-space: pre-line; }

/* ── LOADING ── */
.loading { grid-column: 1/-1; text-align: center; padding: 60px; color: var(--grey); font-size: 1rem; }

/* ── FOOTER ── */
.footer { text-align: center; padding: 32px 24px; color: var(--grey); font-size: 0.85rem; border-top: 1px solid var(--border); }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .exam-header { padding: 0 12px; }
  .exam-body { padding: 16px; }
  .question-text { font-size: 1rem; padding: 16px; }
  .answers { padding: 0 12px; }
  .hero-stats { gap: 12px; }
  .stat-card { padding: 16px 24px; }
  .nav-links { display: none; }
}

/* ── LEÇONS / CHAPTERS ───────────────────────────────────────── */
.chapters-preview { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.chapter-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 16px; padding: 20px; cursor: pointer; transition: all .25s; }
.chapter-card:hover { border-color: var(--teal); transform: translateY(-2px); }
.chapter-icon { font-size: 2rem; margin-bottom: 10px; }
.chapter-num { font-size: 0.75rem; font-weight: 700; color: var(--teal); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.chapter-name { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.chapter-count { font-size: 0.82rem; color: var(--grey); }
.chapters-grid { max-width: 1200px; margin: 0 auto; padding: 0 24px 60px; }
.chapter-section { margin-bottom: 40px; }
.chapter-section-title { font-size: 1.1rem; font-weight: 700; color: var(--teal); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.lessons-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.lesson-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: 14px; padding: 16px 20px; cursor: pointer; transition: all .2s; display: flex; align-items: center; gap: 14px; }
.lesson-card:hover { border-color: var(--teal); background: rgba(78,205,196,0.05); }
.lesson-icon { font-size: 1.6rem; flex-shrink: 0; }
.lesson-info { flex: 1; }
.lesson-name { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.lesson-count { font-size: 0.8rem; color: var(--grey); }
.lesson-mode-badge { background: rgba(78,205,196,0.1); border: 1px solid rgba(78,205,196,0.2); color: var(--teal); font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 20px; text-transform: uppercase; margin-top: 4px; display: inline-block; }
/* Lesson mode - no timer countdown shown as 15 */
.timer-wrap.lesson-mode .timer-fg { stroke: var(--teal); opacity: 0.3; }
.timer-num.lesson-mode { color: var(--grey); font-size: 0.7rem; }

/* ── FAUTE GRAVE (HIGH severity) ─────────────────────────────── */
.question-card.high-severity {
  border-color: rgba(255, 107, 53, 0.5);
  box-shadow: 0 0 0 1px rgba(255,107,53,0.2), 0 4px 24px rgba(255,107,53,0.08);
}
.grave-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 107, 53, 0.15);
  border: 1px solid rgba(255, 107, 53, 0.4);
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.dot.high { background: var(--error); border: 2px solid var(--orange); }
.dot.high.correct { background: var(--success); border-color: var(--orange); }
.timer-wrap.audio-pending .timer-fg { stroke: rgba(255,255,255,0.2); }
.timer-num.audio-pending { color: rgba(255,255,255,0.3); }
.review-item.grave { border-color: rgba(255,107,53,0.5); }
.review-item .grave-label { color: var(--orange); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; }
.results-status.grave-fail { background: rgba(255,107,53,0.15); color: var(--orange); border: 1px solid rgba(255,107,53,0.4); }
