/* ── First-run welcome banner ─────────────────────────────────────────────────── */
#welcome-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 660px;
  margin: 0 auto 16px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(59,130,246,0.12));
  border: 1px solid var(--accent);
  border-radius: 16px;
  box-shadow: 0 4px 24px var(--glow);
}
#welcome-banner .wb-emoji { font-size: 1.8rem; line-height: 1; }
#welcome-banner .wb-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
#welcome-banner .wb-text strong { color: var(--text); font-size: 0.98rem; }
#welcome-banner .wb-text span { color: var(--muted); font-size: 0.82rem; }
#welcome-banner .wb-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
#welcome-banner .wb-btn:hover { border-color: var(--accent); }
#welcome-banner .wb-btn:active { transform: scale(0.97); }
#welcome-banner .wb-primary {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
#welcome-banner .wb-primary:hover { background: #8b4ef0; }

@media (max-width: 720px) {
  #welcome-banner { flex-wrap: wrap; gap: 10px; }
  #welcome-banner .wb-text { flex-basis: calc(100% - 60px); }
  #welcome-banner .wb-primary { flex: 1; }
}

/* ── Card ─────────────────────────────────────────────────────────────────────── */
#card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px 30px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(124,58,237,0.08);
  max-width: 660px;
  margin: 0 auto;
}

.category-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 18px;
  border: 1px solid;
}

/* Topic badge (theme axis) — neutral pill beside the colored category badge */
.theme-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  margin-bottom: 18px;
  margin-left: 6px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.28);
}

/* ℹ️ rule-card button (grammar tip) — sits in the card-top next to the badges. */
.rule-btn {
  margin-left: 6px;
  margin-bottom: 18px;
  padding: 1px 7px;
  font-size: 13px;
  line-height: 1.4;
  border-radius: 20px;
  cursor: pointer;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.28);
  transition: background 0.15s, transform 0.1s;
}
.rule-btn:hover { background: rgba(148, 163, 184, 0.22); transform: translateY(-1px); }

/* Rule-card modal body sections. */
.rule-section { margin-bottom: 16px; }
.rule-section:last-child { margin-bottom: 0; }
.rule-h {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.rule-section p { margin: 0; line-height: 1.5; }
.rule-ex { margin: 0; padding-left: 18px; line-height: 1.6; }
.rule-ex li { margin-bottom: 3px; }

/* Conjugation table inside the rule card. */
.conj-table { width: 100%; border-collapse: collapse; }
.conj-table td {
  padding: 5px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  font-size: 15px;
}
.conj-table tr:last-child td { border-bottom: none; }
.conj-table .conj-hit td,
.conj-table tr.conj-hit td {
  font-weight: 800;
  color: var(--accent, #10b981);
  background: rgba(16, 185, 129, 0.1);
  border-radius: 4px;
}

.q-prompt {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 10px;
}

.q-text {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  color: #f0eeff;
  word-break: break-word;
}

.xp-preview {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 18px;
}
.xp-preview .xv { color: var(--accent); font-weight: 700; }

textarea {
  width: 100%;
  background: #0c0c22;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  resize: none;
  outline: none;
  line-height: 1.5;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus    { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
textarea.t-ok     { border-color: var(--green);  background: #091f16; }
textarea.t-close  { border-color: var(--orange); background: #1f1200; }
textarea.t-wrong  { border-color: var(--red);    background: #1f0808; }
textarea:disabled { opacity: 0.75; cursor: default; }

.hint-area { margin-top: 10px; min-height: 22px; }
.hint-text {
  font-size: 13px;
  font-family: ui-monospace, monospace;
  color: var(--muted);
  background: #0c0c22;
  padding: 6px 10px;
  border-radius: 6px;
  letter-spacing: 1.5px;
}

.explain-block {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.explain-h {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.explain-tip {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.feedback {
  margin-top: 14px;
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.6;
}
.fb-ok    { background: #081f14; border: 1px solid #1a5030; color: #6ee7b7; }
.fb-close { background: #1f1100; border: 1px solid #5a3800; color: #fcd34d; }
.fb-wrong { background: #1f0808; border: 1px solid #5a1818; color: #fca5a5; }
.feedback em  { font-style: normal; font-weight: 600; }
.feedback .combo-bonus { margin-left: 8px; font-weight: 700; }
.feedback .shield-note { display: block; margin-top: 4px; color: #93c5fd; font-size: 12px; }
.feedback .fb-alts { opacity: 0.65; font-size: 13px; }
.feedback .fb-practice { opacity: 0.7; font-size: 12px; font-style: italic; }

/* All valid answers revealed under the QCM verdict (incl. alternatives). */
.mcq-allforms {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}
.mcq-allforms .maf-label { color: var(--muted); font-size: 12px; font-weight: 700; margin-right: 6px; }
.mcq-allforms em { font-style: normal; font-weight: 600; color: #f0eeff; }

/* C-B1: grammatical hint shown under a wrong QCM pick (tense / role contrast). */
.mcq-explain {
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #1a1206;
  border: 1px solid #5a3800;
  color: #fcd34d;
  font-size: 13px;
  line-height: 1.6;
}
.mcq-explain em { font-style: normal; font-weight: 600; }

.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

button {
  font-family: inherit;
  font-size: 14px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.15s;
  padding: 10px 20px;
  color: var(--text);
  background: transparent;
}
button:active:not(:disabled) { transform: scale(0.97); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: #6d28d9; border-color: #6d28d9; }

.btn-secondary { color: var(--muted); }
.btn-secondary:hover:not(:disabled) { background: #1a1a3a; color: var(--text); }

/* Skip — clearly a button (filled chip), tinted amber so it reads as "pass /
   caution: resets combo" rather than looking disabled like a plain link. */
.btn-skip {
  background: #241a14;
  border-color: #5a3f1e;
  color: #f0c98a;
  font-weight: 600;
}
.btn-skip:hover:not(:disabled) { background: #33260f; border-color: var(--orange); color: #ffd9a0; }

.btn-link {
  background: none;
  border-color: transparent;
  color: var(--accent2);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 13px;
  padding: 10px 12px;
}
.btn-link:hover:not(:disabled) { color: #93c5fd; }

/* ── Voice (modules/voice.js): 🎤 answer-by-voice + 🔊 read-aloud ─────────────── */
.mic-btn {
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
}
.mic-btn.listening {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(239, 68, 68, 0); }
}

/* ── Niveau 1 — QCM (multiple choice) ─────────────────────────────────────────── */
.dir-badge.level-badge {
  background: rgba(124,58,237,0.15);
  color: var(--accent);
  border: 1px solid rgba(124,58,237,0.35);
}

/* ── Boss final (gold gate question) ──────────────────────────────────────────── */
#card.boss {
  border-color: rgba(251, 191, 36, 0.55);
  background:
    linear-gradient(160deg, rgba(251,191,36,0.10), rgba(251,191,36,0.02) 60%),
    var(--card);
  box-shadow: 0 4px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(251,191,36,0.25),
    0 0 28px rgba(251,191,36,0.18);
}
.dir-badge.boss-badge {
  background: rgba(251,191,36,0.18);
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.55);
  font-weight: 800;
  letter-spacing: 0.5px;
}
.boss-source {
  font-size: 13px;
  font-style: italic;
  color: #d6b770;
  margin: -4px 0 14px;
}
#card.boss .q-level-hint { color: #e3b94f; font-weight: 700; }

/* Cloze: English prompt then the French sentence with inline blanks */
/* The sentence to translate (source): cool tint, so it reads as the prompt … */
.q-en-prompt {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.4;
  color: #93a4dd;
  margin-bottom: 10px;
  word-break: break-word;
}
.q-cloze {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 18px;
  color: #f0eeff;
}
.cloze-blank {
  display: inline-block;
  min-width: 60px;
  padding: 0 8px;
  margin: 0 2px;
  border-bottom: 2px dashed var(--accent);
  color: var(--muted);
  text-align: center;
}
.cloze-blank.filled {
  border-bottom-style: solid;
  border-bottom-color: var(--green);
  color: #f0eeff;
}

.mcq-group { margin-bottom: 12px; }
.mcq-group-tag {
  display: block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.mcq-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
}
.mcq-btn {
  background: #0c0c22;
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 16px;
  padding: 11px 18px;
  flex: 1 1 auto;
  min-width: 120px;
  text-align: center;
}
.mcq-btn:hover:not(:disabled)  { border-color: var(--accent); background: #15152e; }
.mcq-btn.selected              { border-color: var(--accent); background: var(--glow); color: #fff; }
.mcq-btn.mcq-correct           { border-color: var(--green); background: #091f16; color: #6ee7b7; }
.mcq-btn.mcq-wrong             { border-color: var(--red);   background: #1f0808; color: #fca5a5; }
.mcq-btn:disabled              { opacity: 1; cursor: default; }
.mcq-btn:not(.selected):not(.mcq-correct):disabled { opacity: 0.45; }

.q-level-hint {
  font-size: 12px;
  color: #a9a6d0;
  background: rgba(124, 58, 237, 0.10);
  border: 1px solid rgba(124, 58, 237, 0.22);
  border-radius: 8px;
  padding: 7px 11px;
  margin-bottom: 14px;
}
.feedback .fb-unlock { color: var(--accent); font-size: 12px; font-weight: 600; }
.feedback .fb-progress { color: #93c5fd; font-size: 12px; font-weight: 600; opacity: 0.85; }
