
/* ======= STYLE UNIFIÉ — Quiz Maths ======= */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

:root {
  --bg: #f8f9fb;
  --card: #fff;
  --accent: #6c63ff;
  --accent2: #8b7aff;
  --green: #27ae60;
  --red: #e74c3c;
  --orange: #f39c12;
  --text: #2c3e50;
  --muted: #95a5a6;
  --border: #e8ecf2;
  --radius: 14px;
}

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

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
  max-width: 700px;
  margin: 0 auto;
  direction: rtl;
}

h3 {
  text-align: center;
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 1.3em;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

/* ===== QUIZ ERREUR + QCM ===== */
#p {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

#s {
  background: #f0f0ff;
  padding: 14px;
  border-radius: 10px;
  line-height: 2;
  font-size: 1em;
  margin-bottom: 14px;
  border-right: 4px solid var(--accent);
}

.opt {
  padding: 12px 16px;
  margin: 8px 0;
  background: #fafbfd;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all .2s;
  font-size: 1em;
}
.opt:hover { border-color: var(--accent); background: #f0f0ff; transform: translateX(-4px); }

.fb {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  font-size: .95em;
  line-height: 1.7;
  animation-duration: .4s;
}
.fb.good { border: 1.5px solid #81e6a0; background: #edfff3; color: #1b7a3d; animation: celebrate .5s ease; }
.fb.bad  { border: 1.5px solid #ffb3b3; background: #fff5f5; color: #c0392b; animation: shake .4s ease; }

/* ===== SCORE BAR ===== */
.score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  background: linear-gradient(135deg, #6c63ff11, #8b7aff11);
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: .9em;
}
.score-bar .score { font-weight: 700; color: var(--accent); }
.score-bar .progress { color: var(--muted); }

/* ===== CHAÎNE DE DÉMONSTRATION ===== */
header {
  text-align: center;
  margin-bottom: 16px;
}
header h1 {
  font-size: 1.3em;
  color: var(--accent);
}
header #meta {
  color: var(--muted);
  font-size: .85em;
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .8em;
  background: #f0f0ff;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.op {
  background: #f9f9ff;
  padding: 12px;
  border-radius: 10px;
  font-size: 1em;
  text-align: center;
  border: 1px dashed var(--accent);
  margin: 10px 0;
}

.columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 500px) { .columns { grid-template-columns: 1fr; } }

.col-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.col-title small { color: var(--muted); font-size: .75em; }

.list {
  min-height: 120px;
  background: #fafbfd;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 8px;
}

.item {
  padding: 10px 14px;
  margin: 6px 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: grab;
  transition: all .2s;
  font-size: .92em;
  user-select: none;
  position: relative;
}
.item:hover { border-color: var(--accent); }
.item:active { cursor: grabbing; transform: scale(.98); }
.item.dragging { opacity: .5; transform: rotate(2deg); }

#target .item { counter-increment: step; padding-right: 42px; }
#target .item::after {
  content: counter(step);
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, #6c63ff, #8b7aff);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-family: 'Cairo', sans-serif;
  font-size: .9em;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(108,99,255,.3); }
.btn.secondary { background: #f0f0ff; color: var(--accent); }

.hint {
  margin-top: 10px;
  color: var(--orange);
  font-size: .88em;
  font-style: italic;
}

.feedback {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fafbfd;
  font-size: .95em;
  transition: all .3s;
  line-height: 1.7;
}
.feedback.good { border-color: #81e6a0; background: #edfff3; color: #1b7a3d; animation: celebrate .5s ease; }
.feedback.bad  { border-color: #ffb3b3; background: #fff5f5; color: #c0392b; animation: shake .4s ease; }

/* ===== NAVIGATION ===== */
.nav-bar {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.nav-bar a {
  padding: 8px 16px;
  background: #f0f0ff;
  color: var(--accent);
  border-radius: 8px;
  text-decoration: none;
  font-size: .85em;
  font-weight: 600;
  transition: all .2s;
}
.nav-bar a:hover { background: var(--accent); color: #fff; }

/* ===== ANIMATIONS ===== */
@keyframes celebrate {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.02); }
  60%  { transform: scale(.99); }
  100% { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
}
