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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  height: 100vh;
  overflow: hidden;
}

#app {
  display: flex;
  height: 100vh;
}

/* Sidebar */
#sidebar {
  width: 280px;
  background: #1a1a2e;
  color: #fff;
  padding: 20px;
  overflow-y: auto;
  flex-shrink: 0;
}

#sidebar h1 {
  font-size: 1.4em;
  margin-bottom: 4px;
}

.subtitle {
  font-size: 0.85em;
  color: #8888aa;
  margin-bottom: 12px;
}

/* Progress bar */
#progress-bar {
  background: #16213e;
  border-radius: 6px;
  height: 8px;
  margin-bottom: 6px;
  overflow: hidden;
}

#progress-fill {
  background: linear-gradient(90deg, #4ecca3, #38d9a9);
  height: 100%;
  width: 0%;
  border-radius: 6px;
  transition: width 0.4s ease;
}

#progress-text {
  font-size: 0.75em;
  color: #8888aa;
  margin-bottom: 16px;
}

.lesson-card {
  background: #16213e;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
  border-left: 3px solid transparent;
}

.lesson-card:hover { background: #1a2744; }
.lesson-card.active { background: #1a2744; border-left-color: #e94560; }
.lesson-card.completed { border-left-color: #4ecca3; }
.lesson-card.completed .lesson-title::after {
  content: " \2713";
  color: #4ecca3;
}

.lesson-card .lesson-title {
  font-size: 0.9em;
  font-weight: 600;
  margin-bottom: 4px;
}

.lesson-card .lesson-theme {
  font-size: 0.75em;
  color: #8888aa;
}

.lesson-card .lesson-level {
  font-size: 0.7em;
  color: #e94560;
  float: right;
  margin-top: -18px;
}

/* Main */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.center-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #666;
}

.hidden { display: none !important; }

/* Chat */
#chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
}

#chat-header {
  background: #fff;
  padding: 14px 20px;
  border-bottom: 1px solid #ddd;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#chat-header-left { flex: 1; }

#chat-title {
  font-weight: 700;
  font-size: 1em;
}

#chat-objective {
  display: block;
  font-size: 0.8em;
  color: #888;
  margin-top: 2px;
}

#chat-header-actions {
  display: flex;
  gap: 8px;
}

#chat-header-actions button {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 0.78em;
  font-weight: 600;
  cursor: pointer;
}

#btn-complete {
  background: #4ecca3;
  color: #fff;
}

#btn-complete:hover { background: #3db890; }

#btn-reset {
  background: #eee;
  color: #666;
}

#btn-reset:hover { background: #ddd; }

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.92em;
  line-height: 1.45;
  word-wrap: break-word;
}

.message.user {
  white-space: pre-wrap;
}

.message.assistant {
  background: #fff;
  color: #1a1a2e;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.message.user {
  background: #b18e04;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
#typing-indicator {
  padding: 10px 20px;
  display: flex;
  gap: 4px;
  align-self: flex-start;
}

#typing-indicator .dot {
  width: 8px;
  height: 8px;
  background: #aaa;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

#typing-indicator .dot:nth-child(2) { animation-delay: 0.2s; }
#typing-indicator .dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-6px); }
}

/* Progress notification */
#progress-notification {
  padding: 10px 20px;
  background: #f0faf5;
  border-top: 1px solid #4ecca3;
  font-size: 0.82em;
  color: #1a1a2e;
  line-height: 1.4;
}

/* Form */
#chat-form {
  display: flex;
  padding: 14px 20px;
  background: #fff;
  border-top: 1px solid #ddd;
  gap: 10px;
}

#chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 20px;
  font-size: 0.92em;
  outline: none;
}

#chat-input:focus { border-color: #e94560; }

#chat-form button {
  background: #b18e04;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 20px;
  font-size: 0.9em;
  font-weight: 600;
  cursor: pointer;
}

#chat-form button:hover { background: #d63851; }
#chat-form button:disabled { background: #ccc; cursor: not-allowed; }

/* --- Menu burger (affiché sur mobile uniquement) --- */
#burger {
  display: none;
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 30;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(26, 26, 46, 0.82);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

#burger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* Le burger devient une croix quand le menu est ouvert */
#app.sidebar-open #burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
#app.sidebar-open #burger span:nth-child(2) { opacity: 0; }
#app.sidebar-open #burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* Responsive */
@media (max-width: 700px) {
  #burger { display: flex; }

  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 250px;
    padding: 56px 16px 16px;
    z-index: 25;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  #app.sidebar-open #sidebar {
    transform: translateX(0);
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.4);
  }

  #sidebar-backdrop { display: block; }
  #app.sidebar-open #sidebar-backdrop { opacity: 1; pointer-events: auto; }

  /* Laisser la place au burger dans les en-têtes */
  #chat-header, #genre-header { padding-left: 60px; }

  .message { max-width: 85%; }
}

/* --- Quiz du genre (Le ou La ?) --- */

.mode-card {
  background: linear-gradient(135deg, #16213e, #1f1b4d);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.2s;
}

.mode-card:hover { background: #1a2744; }
.mode-card.active { border-left-color: #e94560; }

.mode-card .mode-title {
  font-size: 0.95em;
  font-weight: 700;
}

.mode-card .mode-desc {
  font-size: 0.75em;
  color: #8888aa;
  margin-top: 2px;
}

.sidebar-section {
  font-size: 0.7em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8888aa;
  margin-bottom: 8px;
}

#genre-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}

#genre-header {
  background: #fff;
  padding: 14px 20px;
  border-bottom: 1px solid #ddd;
}

#genre-title { font-weight: 700; }

#genre-sub {
  display: block;
  font-size: 0.8em;
  color: #888;
  margin-top: 2px;
}

#genre-home, #genre-play, #genre-recap {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 30px 20px;
  text-align: center;
}

.genre-stats-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.stat-tile {
  flex: 1;
  background: #fff;
  border-radius: 12px;
  padding: 14px 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-big {
  font-size: 1.5em;
  font-weight: 700;
  color: #1a1a2e;
}

.stat-label {
  font-size: 0.72em;
  color: #888;
}

#genre-level-bar {
  background: #e2e5ea;
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}

#genre-level-fill {
  background: linear-gradient(90deg, #4ecca3, #38d9a9);
  height: 100%;
  width: 0%;
  transition: width 0.4s ease;
}

#genre-level-text {
  font-size: 0.75em;
  color: #888;
  margin: 6px 0 4px;
}

#genre-review-info {
  font-size: 0.85em;
  color: #666;
  margin-bottom: 16px;
}

#genre-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}

.badge {
  background: #fff;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.85em;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  opacity: 0.35;
  filter: grayscale(1);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.badge.earned { opacity: 1; filter: none; }

.badge .badge-label { font-size: 0.85em; color: #555; }

#btn-start-session, #btn-again {
  background: #4ecca3;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 14px 28px;
  font-size: 1em;
  font-weight: 700;
  cursor: pointer;
}

#btn-start-session:hover, #btn-again:hover { background: #3db890; }

#genre-progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 20px;
}

.dot-q {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d5d9e0;
}

.dot-q.current { background: #b18e04; transform: scale(1.25); }
.dot-q.ok { background: #4ecca3; }
.dot-q.ko { background: #e94560; }

#genre-phase {
  font-size: 0.9em;
  font-weight: 600;
  color: #b18e04;
  margin-bottom: 14px;
}

#genre-word-card {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 44px 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}

#genre-word {
  font-size: 2.2em;
  font-weight: 700;
  color: #1a1a2e;
}

#genre-review-tag {
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 0.7em;
  color: #b18e04;
  background: #fdf6dd;
  border-radius: 10px;
  padding: 3px 8px;
}

#genre-combo {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 0.85em;
  font-weight: 700;
  color: #e94560;
}

.xp-pop {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  color: #4ecca3;
  font-weight: 700;
  font-size: 0.9em;
  animation: xp-rise 0.9s ease-out forwards;
  pointer-events: none;
}

@keyframes xp-rise {
  from { opacity: 1; transform: translateX(-50%) translateY(0); }
  to { opacity: 0; transform: translateX(-50%) translateY(-24px); }
}

#genre-choices {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.genre-choice {
  flex: 1;
  max-width: 180px;
  padding: 18px 0;
  font-size: 1.3em;
  font-weight: 700;
  border: 2px solid #d5d9e0;
  border-radius: 14px;
  background: #fff;
  color: #1a1a2e;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.genre-choice:hover:not(:disabled) { border-color: #b18e04; }
.genre-choice.correct { border-color: #4ecca3; background: #eafaf3; }
.genre-choice.wrong { border-color: #e94560; background: #fdecef; }
.genre-choice:disabled { cursor: default; }

.genre-kbd-hint {
  font-size: 0.72em;
  color: #aaa;
  margin-top: 10px;
}

#genre-feedback {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95em;
  text-align: left;
}

#genre-feedback.good { background: #eafaf3; color: #1a6f52; }
#genre-feedback.bad { background: #fdecef; color: #a3243d; }

#genre-feedback .tip {
  display: block;
  margin-top: 6px;
  font-size: 0.85em;
  color: #666;
}

#btn-genre-next {
  margin-top: 14px;
  background: #b18e04;
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 10px 26px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
}

#genre-recap h2 { margin-bottom: 12px; }

#recap-score {
  font-size: 1.3em;
  font-weight: 700;
  margin-bottom: 8px;
}

#recap-details {
  color: #666;
  font-size: 0.9em;
  margin-bottom: 14px;
}

#recap-still-wrong {
  background: #fdf6dd;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88em;
  color: #7a6205;
  margin-bottom: 14px;
}

.new-badge {
  background: #fff;
  border: 1px solid #4ecca3;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 0.92em;
  animation: badge-in 0.4s ease;
}

@keyframes badge-in {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

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

#btn-back-home {
  background: #eee;
  color: #666;
  border: none;
  border-radius: 24px;
  padding: 14px 28px;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
}

#btn-back-home:hover { background: #ddd; }

/* --- Réglages de session --- */

#genre-settings {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85em;
  color: #666;
}

#size-select {
  display: inline-flex;
  border: 1px solid #d5d9e0;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
}

.size-opt {
  border: none;
  background: transparent;
  padding: 6px 16px;
  font-size: 0.9em;
  font-weight: 600;
  color: #666;
  cursor: pointer;
}

.size-opt.active {
  background: #b18e04;
  color: #fff;
}

#chrono-toggle { cursor: pointer; }
#chrono-toggle input { accent-color: #b18e04; }

#btn-review-page {
  display: block;
  margin: 12px auto 0;
  background: none;
  border: none;
  color: #666;
  font-size: 0.9em;
  text-decoration: underline;
  cursor: pointer;
}

#btn-review-page:hover { color: #1a1a2e; }

/* --- Chrono --- */

#genre-timer {
  background: #e2e5ea;
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
  margin-bottom: 16px;
}

#genre-timer-fill {
  background: linear-gradient(90deg, #b18e04, #e94560);
  height: 100%;
  width: 100%;
  transition: width 0.1s linear;
}

/* --- Page révision & règles --- */

#genre-review-view { text-align: left; }

#genre-review-view h2 {
  text-align: center;
  margin-bottom: 16px;
}

#genre-review-view h3 {
  font-size: 0.95em;
  color: #666;
  margin: 22px 0 10px;
}

#btn-review-session {
  display: block;
  margin: 0 auto;
  background: #b18e04;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 12px 24px;
  font-size: 0.95em;
  font-weight: 700;
  cursor: pointer;
}

#btn-review-session:hover:not(:disabled) { background: #9a7b03; }
#btn-review-session:disabled { background: #ccc; cursor: default; }

#review-empty {
  text-align: center;
  color: #a3243d;
  font-size: 0.88em;
  margin-top: 10px;
}

.review-note {
  color: #888;
  font-size: 0.88em;
}

.diff-word {
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.diff-word strong { font-size: 0.95em; }

.diff-word span {
  font-size: 0.78em;
  color: #888;
  text-align: right;
}

.rule-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
  border-left: 3px solid #d5d9e0;
  font-size: 0.88em;
}

.rule-card.f { border-left-color: #e94560; }
.rule-card.m { border-left-color: #4a7dd6; }
.rule-card.rule-both { border-left-color: #b18e04; }

.rule-card strong {
  display: inline-block;
  min-width: 110px;
}

.rule-card .rule-ex {
  display: block;
  color: #a3243d;
  font-size: 0.85em;
  margin-top: 3px;
}

#btn-review-back {
  display: block;
  margin: 20px auto 0;
  background: #eee;
  color: #666;
  border: none;
  border-radius: 24px;
  padding: 12px 26px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
}

#btn-review-back:hover { background: #ddd; }

/* Correctif : la marge pour le burger doit primer sur les styles d'en-tête
   du quiz définis plus haut dans le fichier (même spécificité, ordre source). */
@media (max-width: 700px) {
  #chat-header,
  #genre-header { padding-left: 60px; }
}

/* --- Module "Les petits mots" --- */
#mots-area { display: flex; flex-direction: column; height: 100%; overflow-y: auto; }
#mots-header { background: #fff; padding: 14px 20px; border-bottom: 1px solid #ddd; }
#mots-title { font-weight: 700; }
#mots-sub { display: block; font-size: 0.8em; color: #888; margin-top: 2px; }

#mots-home, #mots-play, #mots-recap, #mots-review-view {
  max-width: 600px; width: 100%; margin: 0 auto; padding: 30px 20px; text-align: center;
}
#mots-review-view { text-align: left; }
#mots-review-view h2 { text-align: center; margin-bottom: 16px; }
#mots-review-view h3 { font-size: 0.95em; color: #666; margin: 22px 0 10px; }

#mots-level-bar { background: #e2e5ea; border-radius: 6px; height: 10px; overflow: hidden; }
#mots-level-fill { background: linear-gradient(90deg, #4ecca3, #38d9a9); height: 100%; width: 0%; transition: width 0.4s ease; }
#mots-level-text { font-size: 0.75em; color: #888; margin: 6px 0 4px; }
#mots-review-info { font-size: 0.85em; color: #666; margin-bottom: 16px; }
#mots-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }

#mots-settings { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-bottom: 20px; }
.setting-col { flex-direction: column; align-items: center; gap: 8px; }
#cat-select { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cat-opt {
  border: 1px solid #d5d9e0; background: #fff; border-radius: 16px; padding: 6px 12px;
  font-size: 0.82em; font-weight: 600; color: #555; cursor: pointer;
}
.cat-opt.active { color: #fff; border-color: transparent; }
.cat-opt.active.cat-tout { background: #555; }
.cat-opt.active.cat-articles { background: #4a7dd6; }
.cat-opt.active.cat-dedes { background: #b18e04; }
.cat-opt.active.cat-verbe-a { background: #2fa36b; }
.cat-opt.active.cat-verbe-de { background: #e0567f; }
.cat-count { opacity: 0.7; font-size: 0.9em; }
#msize-select { display: inline-flex; border: 1px solid #d5d9e0; border-radius: 18px; overflow: hidden; background: #fff; }
.msize-opt { border: none; background: transparent; padding: 6px 16px; font-size: 0.9em; font-weight: 600; color: #666; cursor: pointer; }
.msize-opt.active { background: #b18e04; color: #fff; }

#btn-mots-start, #btn-mots-again, #btn-mots-review-session {
  background: #4ecca3; color: #fff; border: none; border-radius: 24px; padding: 14px 28px;
  font-size: 1em; font-weight: 700; cursor: pointer; display: block; margin: 0 auto;
}
#btn-mots-start:hover, #btn-mots-again:hover, #btn-mots-review-session:hover:not(:disabled) { background: #3db890; }
#btn-mots-review-session:disabled { background: #ccc; cursor: default; }
#btn-mots-review-page { display: block; margin: 12px auto 0; background: none; border: none; color: #666; font-size: 0.9em; text-decoration: underline; cursor: pointer; }
#btn-mots-review-page:hover { color: #1a1a2e; }
#btn-mots-back-home, #btn-mots-review-back {
  display: block; margin: 20px auto 0; background: #eee; color: #666; border: none;
  border-radius: 24px; padding: 12px 26px; font-size: 0.95em; font-weight: 600; cursor: pointer;
}

#mots-progress-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
#mots-phase { font-size: 0.9em; font-weight: 600; color: #b18e04; margin-bottom: 14px; }

#mots-question-card { position: relative; background: #fff; border-radius: 16px; padding: 40px 22px 34px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 18px; }
#mots-sentence { font-size: 1.4em; font-weight: 600; color: #1a1a2e; line-height: 1.6; }
.blank { display: inline-block; min-width: 52px; border-bottom: 2px dashed #b18e04; color: transparent; vertical-align: bottom; }
.blank.filled { border-bottom: 2px solid #4ecca3; color: #1a6f52; font-weight: 700; }
#mots-cat-tag.cat-tag { position: absolute; top: 10px; left: 14px; font-size: 0.68em; font-weight: 600; padding: 3px 8px; border-radius: 10px; color: #fff; }
.cat-tag.cat-articles { background: #4a7dd6; }
.cat-tag.cat-dedes { background: #b18e04; }
.cat-tag.cat-verbe-a { background: #2fa36b; }
.cat-tag.cat-verbe-de { background: #e0567f; }
#mots-review-tag { position: absolute; top: 10px; right: 14px; font-size: 0.7em; color: #b18e04; background: #fdf6dd; border-radius: 10px; padding: 3px 8px; }
#mots-combo { position: absolute; bottom: 8px; right: 14px; font-size: 0.85em; font-weight: 700; color: #e94560; }

#mots-choices { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.mots-choice {
  flex: 1 1 40%; min-width: 110px; max-width: 200px; padding: 14px 0; font-size: 1.15em;
  font-weight: 700; border: 2px solid #d5d9e0; border-radius: 12px; background: #fff; color: #1a1a2e;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.mots-choice:hover:not(:disabled) { border-color: #b18e04; }
.mots-choice.correct { border-color: #4ecca3; background: #eafaf3; }
.mots-choice.wrong { border-color: #e94560; background: #fdecef; }
.mots-choice:disabled { cursor: default; }

#mots-feedback { margin-top: 18px; padding: 12px 16px; border-radius: 10px; font-size: 0.95em; text-align: left; }
#mots-feedback.good { background: #eafaf3; color: #1a6f52; }
#mots-feedback.bad { background: #fdecef; color: #a3243d; }
.fb-head { font-weight: 700; margin-bottom: 8px; }
.fb-tip { margin-bottom: 8px; }
.fb-contrast { display: flex; flex-direction: column; gap: 4px; }
.fb-contrast span { background: #fff; border-radius: 8px; padding: 6px 10px; font-size: 0.9em; color: #444; }
#btn-mots-next { margin-top: 14px; background: #b18e04; color: #fff; border: none; border-radius: 20px; padding: 10px 26px; font-size: 0.95em; font-weight: 600; cursor: pointer; }

#mots-recap-score { font-size: 1.3em; font-weight: 700; margin-bottom: 8px; }
#mots-recap-details { color: #666; font-size: 0.9em; margin-bottom: 14px; }
#mots-recap-still-wrong { background: #fdf6dd; border-radius: 10px; padding: 10px 14px; font-size: 0.88em; color: #7a6205; margin-bottom: 14px; text-align: left; }

#mots-difficult { margin-bottom: 8px; }
.diff-sentence { flex: 1; text-align: left; font-size: 0.9em; color: #333; }
.cat-border-articles { border-left: 3px solid #4a7dd6 !important; }
.cat-border-dedes { border-left: 3px solid #b18e04 !important; }
.cat-border-verbe-a { border-left: 3px solid #2fa36b !important; }
.cat-border-verbe-de { border-left: 3px solid #e0567f !important; }
.rule-ex-ok { display: block; color: #1a6f52; font-size: 0.85em; margin-top: 3px; }

@media (max-width: 700px) {
  #mots-header { padding-left: 60px; }
  .mots-choice { flex: 1 1 100%; max-width: none; }
}

/* --- Cartes mémoire (écran Règles & contrastes du module "mots") --- */
.memo-card {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 4px solid #d5d9e0;
}
.memo-title { font-weight: 700; font-size: 1.02em; margin-bottom: 10px; color: #1a1a2e; }
.memo-points { list-style: none; margin: 0 0 10px; padding: 0; }
.memo-points li { font-size: 0.9em; color: #333; line-height: 1.5; margin-bottom: 6px; padding-left: 14px; position: relative; }
.memo-points li::before { content: "▸"; position: absolute; left: 0; color: #b18e04; }
.memo-points i { color: #777; }

.memo-contrasts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.memo-contrast {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  background: #f6f8fb; border-radius: 8px; padding: 7px 12px;
}
.mc-a { font-size: 0.92em; color: #1a1a2e; }
.mc-b { font-size: 0.82em; color: #666; }
.mc-b::before { content: "→ "; color: #4ecca3; font-weight: 700; }

.memo-warn {
  background: #fdf6dd; border-radius: 8px; padding: 8px 12px;
  font-size: 0.85em; color: #7a6205; line-height: 1.45; margin-bottom: 8px;
}
.memo-phrase {
  background: #eafaf3; border-radius: 8px; padding: 8px 12px;
  font-size: 0.88em; color: #1a6f52; font-weight: 600; line-height: 1.4;
}

/* --- Duos contrastés (piège de contexte) --- */
#mots-duo-banner {
  background: #f3ecff;
  color: #6a3fb0;
  border: 1px solid #d9c7f5;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 14px;
}
.fb-duo-recap {
  margin-top: 10px;
  background: #fff7e6;
  border: 1px solid #f0d8a0;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 0.9em;
  color: #7a5a10;
  font-weight: 600;
  line-height: 1.45;
}

/* --- Module "Conjugaison" --- */
#conj-area { display: flex; flex-direction: column; height: 100%; overflow-y: auto; }
#conj-header { background: #fff; padding: 14px 20px; border-bottom: 1px solid #ddd; }
#conj-title { font-weight: 700; }
#conj-sub { display: block; font-size: 0.8em; color: #888; margin-top: 2px; }

#conj-home, #conj-play, #conj-recap, #conj-review-view {
  max-width: 600px; width: 100%; margin: 0 auto; padding: 30px 20px; text-align: center;
}
#conj-review-view { text-align: left; }
#conj-review-view h2 { text-align: center; margin-bottom: 16px; }
#conj-review-view h3 { font-size: 0.95em; color: #666; margin: 22px 0 10px; }

#conj-level-bar { background: #e2e5ea; border-radius: 6px; height: 10px; overflow: hidden; }
#conj-level-fill { background: linear-gradient(90deg, #4ecca3, #38d9a9); height: 100%; width: 0%; transition: width 0.4s ease; }
#conj-level-text { font-size: 0.75em; color: #888; margin: 6px 0 4px; }
#conj-review-info { font-size: 0.85em; color: #666; margin-bottom: 16px; }
#conj-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 20px; }

#conj-settings { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-bottom: 20px; }
#ccat-select { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
#csize-select { display: inline-flex; border: 1px solid #d5d9e0; border-radius: 18px; overflow: hidden; background: #fff; }
.csize-opt { border: none; background: transparent; padding: 6px 16px; font-size: 0.9em; font-weight: 600; color: #666; cursor: pointer; }
.csize-opt.active { background: #b18e04; color: #fff; }

/* Couleurs par temps */
.cat-opt.active.cat-present { background: #4a7dd6; }
.cat-opt.active.cat-passe-compose { background: #e0567f; }
.cat-opt.active.cat-imparfait { background: #b18e04; }
.cat-opt.active.cat-futur-conditionnel { background: #2fa36b; }
.cat-opt.active.cat-subjonctif { background: #8a5cf6; }
.cat-tag.cat-present { background: #4a7dd6; }
.cat-tag.cat-passe-compose { background: #e0567f; }
.cat-tag.cat-imparfait { background: #b18e04; }
.cat-tag.cat-futur-conditionnel { background: #2fa36b; }
.cat-tag.cat-subjonctif { background: #8a5cf6; }
.cat-border-present { border-left: 3px solid #4a7dd6 !important; }
.cat-border-passe-compose { border-left: 3px solid #e0567f !important; }
.cat-border-imparfait { border-left: 3px solid #b18e04 !important; }
.cat-border-futur-conditionnel { border-left: 3px solid #2fa36b !important; }
.cat-border-subjonctif { border-left: 3px solid #8a5cf6 !important; }

#btn-conj-start, #btn-conj-again, #btn-conj-review-session {
  background: #4ecca3; color: #fff; border: none; border-radius: 24px; padding: 14px 28px;
  font-size: 1em; font-weight: 700; cursor: pointer; display: block; margin: 0 auto;
}
#btn-conj-start:hover, #btn-conj-again:hover, #btn-conj-review-session:hover:not(:disabled) { background: #3db890; }
#btn-conj-review-session:disabled { background: #ccc; cursor: default; }
#btn-conj-review-page { display: block; margin: 12px auto 0; background: none; border: none; color: #666; font-size: 0.9em; text-decoration: underline; cursor: pointer; }
#btn-conj-review-page:hover { color: #1a1a2e; }
#btn-conj-back-home, #btn-conj-review-back {
  display: block; margin: 20px auto 0; background: #eee; color: #666; border: none;
  border-radius: 24px; padding: 12px 26px; font-size: 0.95em; font-weight: 600; cursor: pointer;
}

#conj-progress-dots { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
#conj-phase { font-size: 0.9em; font-weight: 600; color: #b18e04; margin-bottom: 14px; }

#conj-question-card { position: relative; background: #fff; border-radius: 16px; padding: 40px 22px 34px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); margin-bottom: 18px; }
#conj-verb-hint { font-size: 0.95em; color: #6a3fb0; background: #f3ecff; border-radius: 20px; padding: 5px 14px; display: inline-block; margin-bottom: 16px; }
#conj-sentence { display: block; font-size: 1.3em; font-weight: 600; color: #1a1a2e; line-height: 1.6; }
#conj-cat-tag.cat-tag { position: absolute; top: 10px; left: 14px; font-size: 0.68em; font-weight: 600; padding: 3px 8px; border-radius: 10px; color: #fff; }
#conj-review-tag { position: absolute; top: 10px; right: 14px; font-size: 0.7em; color: #b18e04; background: #fdf6dd; border-radius: 10px; padding: 3px 8px; }
#conj-combo { position: absolute; bottom: 8px; right: 14px; font-size: 0.85em; font-weight: 700; color: #e94560; }

#conj-choices { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.conj-choice {
  flex: 1 1 42%; min-width: 130px; max-width: 240px; padding: 14px 8px; font-size: 1.1em;
  font-weight: 700; border: 2px solid #d5d9e0; border-radius: 12px; background: #fff; color: #1a1a2e;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.conj-choice:hover:not(:disabled) { border-color: #b18e04; }
.conj-choice.correct { border-color: #4ecca3; background: #eafaf3; }
.conj-choice.wrong { border-color: #e94560; background: #fdecef; }
.conj-choice:disabled { cursor: default; }

#conj-feedback { margin-top: 18px; padding: 12px 16px; border-radius: 10px; font-size: 0.95em; text-align: left; }
#conj-feedback.good { background: #eafaf3; color: #1a6f52; }
#conj-feedback.bad { background: #fdecef; color: #a3243d; }

#btn-conj-next { margin-top: 14px; background: #b18e04; color: #fff; border: none; border-radius: 20px; padding: 10px 26px; font-size: 0.95em; font-weight: 600; cursor: pointer; }

#conj-recap-score { font-size: 1.3em; font-weight: 700; margin-bottom: 8px; }
#conj-recap-details { color: #666; font-size: 0.9em; margin-bottom: 14px; }
#conj-recap-still-wrong { background: #fdf6dd; border-radius: 10px; padding: 10px 14px; font-size: 0.88em; color: #7a6205; margin-bottom: 14px; text-align: left; }
#conj-difficult { margin-bottom: 8px; }

@media (max-width: 700px) {
  #conj-header { padding-left: 60px; }
  .conj-choice { flex: 1 1 100%; max-width: none; }
}

/* --- Écran "Comprendre" (conjugaison) --- */
#conj-learn { max-width: 640px; width: 100%; margin: 0 auto; padding: 30px 20px; text-align: left; }
#conj-learn h2 { text-align: center; margin-bottom: 18px; }

#btn-conj-learn {
  display: block; margin: 10px auto 0; background: #fff; color: #6a3fb0;
  border: 1px solid #d9c7f5; border-radius: 24px; padding: 11px 22px;
  font-size: 0.95em; font-weight: 700; cursor: pointer;
}
#btn-conj-learn:hover { background: #f3ecff; }
#btn-conj-learn-back {
  display: block; margin: 20px auto 0; background: #eee; color: #666; border: none;
  border-radius: 24px; padding: 12px 26px; font-size: 0.95em; font-weight: 600; cursor: pointer;
}

.learn-section {
  background: #fff; border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-left: 4px solid #d5d9e0;
}
.learn-neutral { border-left-color: #8888aa; }
.learn-title { font-weight: 700; font-size: 1.05em; color: #1a1a2e; margin-bottom: 10px; }
.learn-h { font-size: 0.9em; color: #666; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.learn-p { font-size: 0.92em; color: #333; line-height: 1.55; margin-bottom: 8px; }

.learn-formule {
  background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 10px;
  padding: 12px 14px; font-size: 1.02em; font-weight: 600; color: #234; text-align: center;
  line-height: 1.5; margin: 6px 0 10px;
}
.learn-ex { list-style: none; margin: 0 0 10px; padding: 0; }
.learn-ex li {
  background: #f6f8fb; border-radius: 8px; padding: 7px 12px; margin-bottom: 5px;
  font-size: 0.9em; color: #333;
}
.learn-endings { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.learn-endings span {
  background: #1a1a2e; color: #fff; border-radius: 8px; padding: 4px 10px;
  font-size: 0.85em; font-weight: 700;
}
.learn-table { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.learn-row { display: flex; gap: 10px; background: #f6f8fb; border-radius: 8px; padding: 7px 12px; }
.lt-a { flex: 0 0 auto; min-width: 92px; font-weight: 700; color: #1a1a2e; font-size: 0.9em; }
.lt-b { flex: 1; color: #444; font-size: 0.9em; }
.learn-astuce {
  background: #eafaf3; border: 1px solid #b9ead2; border-radius: 8px;
  padding: 9px 12px; font-size: 0.9em; color: #1a6f52; line-height: 1.45; margin: 6px 0 4px;
}
.learn-warn {
  background: #fff7e6; border: 1px solid #f0d8a0; border-radius: 8px;
  padding: 9px 12px; font-size: 0.9em; color: #7a5a10; line-height: 1.45; margin: 6px 0 4px;
}

@media (max-width: 700px) {
  #conj-learn { padding-left: 16px; padding-right: 16px; }
  .lt-a { min-width: 76px; }
}

/* --- Écrans "Comprendre" partagés (genre / mots) --- */
.learn-screen { max-width: 640px; width: 100%; margin: 0 auto; padding: 30px 20px; text-align: left; }
.learn-screen h2 { text-align: center; margin-bottom: 18px; }
.btn-learn {
  display: block; margin: 10px auto 0; background: #fff; color: #6a3fb0;
  border: 1px solid #d9c7f5; border-radius: 24px; padding: 11px 22px;
  font-size: 0.95em; font-weight: 700; cursor: pointer;
}
.btn-learn:hover { background: #f3ecff; }
#btn-genre-learn-back, #btn-mots-learn-back {
  display: block; margin: 20px auto 0; background: #eee; color: #666; border: none;
  border-radius: 24px; padding: 12px 26px; font-size: 0.95em; font-weight: 600; cursor: pointer;
}
.cat-border-fem { border-left: 3px solid #e94560 !important; }
.cat-border-masc { border-left: 3px solid #4a7dd6 !important; }

/* --- Parcours guidé (progression par concept) --- */
.btn-parcours {
  display: block; margin: 0 auto 10px; background: #4ecca3; color: #fff; border: none;
  border-radius: 24px; padding: 14px 28px; font-size: 1.02em; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 8px rgba(78,204,163,0.35);
}
.btn-parcours:hover { background: #3db890; }
/* La session "mélange" devient secondaire : le parcours est la voie principale */
#btn-start-session, #btn-mots-start, #btn-conj-start {
  background: #fff !important; color: #2a9d78 !important; border: 1.5px solid #bfe9d8 !important;
}
#btn-start-session:hover, #btn-mots-start:hover, #btn-conj-start:hover { background: #f3fbf8 !important; }

.parcours-intro { font-size: 0.88em; color: #666; text-align: center; margin-bottom: 16px; line-height: 1.5; }
.unit-card {
  background: #fff; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-left: 4px solid #d5d9e0;
}
.unit-focus { box-shadow: 0 0 0 2px #4ecca3, 0 1px 3px rgba(0,0,0,0.08); }
.unit-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.unit-num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: #1a1a2e; color: #fff;
  font-size: 0.8em; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.unit-title { font-weight: 700; color: #1a1a2e; flex: 1; }
.unit-badge { font-size: 0.72em; font-weight: 700; color: #1a6f52; background: #eafaf3; border-radius: 10px; padding: 3px 8px; }
.unit-done { color: #4ecca3; font-weight: 700; font-size: 1.1em; }
.unit-bar { background: #e2e5ea; border-radius: 6px; height: 8px; overflow: hidden; }
.unit-fill { background: linear-gradient(90deg, #4ecca3, #38d9a9); height: 100%; width: 0%; transition: width 0.4s ease; }
.unit-meta { font-size: 0.78em; color: #888; margin: 5px 0 10px; }
.unit-actions { display: flex; gap: 8px; }
.unit-lesson, .unit-practice {
  flex: 1; border: none; border-radius: 10px; padding: 10px; font-size: 0.88em; font-weight: 700; cursor: pointer;
}
.unit-lesson { background: #f3ecff; color: #6a3fb0; }
.unit-lesson:hover { background: #e9dbff; }
.unit-practice { background: #4ecca3; color: #fff; }
.unit-practice:hover { background: #3db890; }

/* --- Ligne "formation" (comment se construit la forme) --- */
.fb-formation {
  margin-top: 8px; background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 8px;
  padding: 8px 12px; font-size: 0.9em; color: #223; line-height: 1.45;
}
.fb-formation .fm-mode { color: #888; font-size: 0.9em; }

.unit-g { font-size: 0.78em; color: #888; font-weight: 600; }

/* --- Fenêtre "verbe complet" --- */
#conj-table-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; }
#conj-table-modal.hidden { display: none !important; }
.ct-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.ct-panel {
  position: relative; background: #fff; border-radius: 16px; max-width: 640px; width: 100%;
  max-height: 88vh; overflow-y: auto; padding: 22px 20px; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
#ct-close {
  position: absolute; top: 10px; right: 12px; width: 32px; height: 32px; border: none;
  border-radius: 50%; background: #eee; color: #555; font-size: 1em; cursor: pointer;
}
#ct-close:hover { background: #ddd; }
.ct-verb { font-size: 1.5em; font-weight: 800; color: #1a1a2e; margin-bottom: 10px; }
.ct-pron-tag { font-size: 0.6em; color: #6a3fb0; background: #f3ecff; border-radius: 8px; padding: 2px 8px; vertical-align: middle; }
.ct-note { background: #eef4ff; border: 1px solid #cfe0ff; border-radius: 8px; padding: 9px 12px; font-size: 0.85em; color: #223; line-height: 1.45; margin-bottom: 14px; }
.ct-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.ct-tense { background: #f6f8fb; border-radius: 10px; padding: 10px 12px; }
.ct-tlabel { font-size: 0.78em; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: #6a3fb0; margin-bottom: 6px; }
.ct-row { font-size: 0.92em; color: #1a1a2e; line-height: 1.6; }
.ct-imp { color: #888; font-size: 0.85em; }
.ct-loading { text-align: center; color: #888; padding: 30px; }
@media (max-width: 560px) { .ct-grid { grid-template-columns: 1fr; } }

.ct-open {
  display: inline-block; margin-top: 10px; background: #fff; color: #6a3fb0;
  border: 1px solid #d9c7f5; border-radius: 18px; padding: 7px 14px;
  font-size: 0.85em; font-weight: 700; cursor: pointer;
}
.ct-open:hover { background: #f3ecff; }

/* ============================================================
   Mode vocal — micro de Pim, voix de Lisa
   ============================================================ */

/* Bouton de coupure de la voix, dans l'en-tête du chat */
#btn-voice {
  background: #16213e;
  color: #fff;
  font-size: 0.95em !important;
  line-height: 1;
  padding: 6px 10px !important;
}
#btn-voice:hover { background: #24325c; }
#btn-voice.off { background: #ddd; color: #888; }

/* Micro dans le formulaire */
#btn-mic {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #16213e;
  color: #fff;
  font-size: 1.1em;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
#btn-mic:hover { background: #24325c; }
#btn-mic:active { transform: scale(0.94); }
#btn-mic:disabled { background: #ccc; cursor: not-allowed; }

#btn-mic.recording {
  background: #e94560;
  animation: micPulse 1.3s ease-in-out infinite;
}
#btn-mic.recording:hover { background: #d63851; }

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.55); }
  50%      { box-shadow: 0 0 0 9px rgba(233, 69, 96, 0); }
}

/* Bandeau d'état vocal, juste au-dessus du formulaire */
#voice-status {
  padding: 8px 20px;
  font-size: 0.82em;
  line-height: 1.4;
  border-top: 1px solid #ddd;
}
#voice-status.rec   { background: #fdecef; color: #a3243a; border-top-color: #e94560; }
#voice-status.work  { background: #f3f4f8; color: #46506e; }
#voice-status.error { background: #fff6e5; color: #8a5a00; border-top-color: #b18e04; }

/* Actions sur un message : écouter (Lisa seulement) et supprimer l'échange */
.message { position: relative; }
.message.assistant { padding-right: 52px; }
.message.user { padding-right: 32px; }

.msg-actions {
  position: absolute;
  right: 5px;
  bottom: 4px;
  display: flex;
  gap: 2px;
}

.msg-actions button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 0.72em;
  line-height: 1;
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.15s, background 0.15s;
}
.message:hover .msg-actions button { opacity: 0.6; }
.msg-actions button:hover { opacity: 1 !important; background: rgba(0, 0, 0, 0.07); }
.message.user .msg-actions button:hover { background: rgba(255, 255, 255, 0.28); }
.msg-speak.playing { opacity: 1 !important; background: #fdecef; }
.msg-del:hover { background: #fdecef !important; }

/* Mobile : pas de survol, donc les actions restent visibles et plus grandes */
@media (max-width: 700px) {
  #btn-mic { width: 46px; height: 46px; font-size: 1.2em; }
  #voice-status { padding: 8px 14px; }
  .msg-actions button { width: 27px; height: 27px; opacity: 0.5; }
  .message.assistant { padding-right: 62px; }
  .message.user { padding-right: 36px; }
}
