:root {
  --blue: #1a56db;
  --blue-dark: #123a8f;
  --red: #dc2626;
  --green: #16a34a;
  --amber: #d97706;
  --ink: #111827;
  --muted: #6b7280;
  --bg: #f4f5f7;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

.wrap { max-width: 920px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.topbar { background: var(--blue); color: #fff; position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; flex-wrap: wrap; gap: 10px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  color: #dbe6fd; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 0.92rem;
}
.topbar nav a:hover { background: rgba(255,255,255,0.12); color: #fff; }
.topbar nav a.active { background: #fff; color: var(--blue); font-weight: 600; }

main.wrap { padding-top: 28px; padding-bottom: 60px; min-height: 70vh; }

/* ---------- typography ---------- */
h1 { font-size: 1.6rem; margin: 0 0 6px; }
h2 { font-size: 1.2rem; margin: 0 0 12px; }
p.lead { color: var(--muted); margin-top: 0; }

/* ---------- cards / layout blocks ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin-bottom: 20px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 680px) { .grid-2 { grid-template-columns: 1fr; } }

.hero { text-align: center; padding: 36px 20px; }
.hero h1 { font-size: 2rem; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 24px; }
@media (max-width: 680px) { .mode-grid { grid-template-columns: 1fr; } }
.mode-card {
  display: block; text-decoration: none; color: inherit; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
  transition: transform .15s, box-shadow .15s; text-align: left;
}
.mode-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(17,24,39,0.08); }
.mode-card .icon { font-size: 1.8rem; }
.mode-card h3 { margin: 10px 0 6px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 0.94rem; }

/* ---------- badges / pills ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
}
.badge.interieure { background: #e0ecff; color: var(--blue-dark); }
.badge.exterieure { background: #fef3c7; color: #92400e; }
.badge.ok { background: #dcfce7; color: #166534; }
.badge.ko { background: #fee2e2; color: #991b1b; }

.filter-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-row a {
  text-decoration: none; padding: 7px 14px; border-radius: 999px; font-size: 0.88rem;
  background: #fff; border: 1px solid var(--border); color: var(--ink);
}
.filter-row a.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------- flashcard ---------- */
.progress-line { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; color: var(--muted); font-size: 0.9rem; }
.flashcard { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.flashcard .question { font-size: 1.2rem; font-weight: 600; margin: 0 0 18px; }
.schema-box { display: flex; justify-content: center; margin: 10px 0 20px; }
.schema { width: 100%; max-width: 320px; height: auto; border-radius: 10px; }

.answer-box {
  margin-top: 18px; padding: 16px 18px; background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px;
}
.answer-box h4 { margin: 0 0 6px; color: #166534; font-size: 0.95rem; text-transform: uppercase; letter-spacing: .03em; }
.answer-box .remarque { margin-top: 10px; font-size: 0.88rem; color: #92400e; background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 8px; }

.actions { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; border: none; border-radius: 10px;
  padding: 11px 20px; font-size: 0.95rem; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-ok { background: #16a34a; color: #fff; }
.btn-ok:hover { background: #15803d; }
.btn-ko { background: #dc2626; color: #fff; }
.btn-ko:hover { background: #b91c1c; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn-ghost:hover { background: #f3f4f6; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- exam ---------- */
.exam-progress { display: flex; gap: 8px; margin-bottom: 18px; }
.exam-progress .dot {
  flex: 1; height: 8px; border-radius: 999px; background: var(--border);
}
.exam-progress .dot.done { background: var(--blue); }
.exam-progress .dot.current { background: var(--amber); }

.score-hero { text-align: center; padding: 26px 0; }
.score-hero .score { font-size: 3rem; font-weight: 800; color: var(--blue); }
.score-hero .score span { font-size: 1.4rem; color: var(--muted); font-weight: 600; }

.result-item { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; }
.result-item .head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.result-item .q { font-weight: 600; }
.result-item .rep { color: var(--muted); font-size: 0.92rem; }

/* ---------- stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 680px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat-tile .num { font-size: 1.8rem; font-weight: 800; color: var(--blue); }
.stat-tile .lbl { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 0.9rem; }
.bar-row .name { width: 150px; flex-shrink: 0; }
.bar-track { flex: 1; height: 10px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--blue); }
.bar-row .pct { width: 44px; text-align: right; color: var(--muted); }

table.simple { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.simple th, table.simple td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
table.simple th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; }

.empty-state { text-align: center; color: var(--muted); padding: 30px 10px; }

.info-box { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; border-radius: 10px; padding: 14px 16px; font-size: 0.9rem; margin-bottom: 20px; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 20px 0 40px; color: var(--muted); font-size: 0.82rem; }
