:root {
  --as-plus-bg: #071f16;
  --as-plus-panel: rgba(9, 42, 30, .94);
  --as-plus-soft: rgba(255,255,255,.07);
  --as-plus-border: rgba(243,210,122,.28);
  --as-plus-gold: #f3d27a;
  --as-plus-text: #f8f7ed;
  --as-plus-muted: #d8ccb0;
  --as-plus-green: #22b573;
}

.as-skip-link {
  position: fixed;
  left: 12px;
  top: -80px;
  z-index: 100002;
  background: #f3d27a;
  color: #102117;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 900;
  text-decoration: none;
}
.as-skip-link:focus { top: 66px; }

.as-module-menu-button {
  position: fixed;
  z-index: 99997;
  right: 16px;
  top: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 999px;
  border: 1px solid rgba(243,210,122,.72);
  background: linear-gradient(135deg, #0d3a2b, #123f31);
  color: #f8f7ed;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 12px 36px rgba(0,0,0,.25);
  cursor: pointer;
}
.as-module-menu-button:hover { transform: translateY(-1px); background: linear-gradient(135deg, #123f31, #18513f); }

.as-module-drawer {
  position: fixed;
  z-index: 100001;
  top: 70px;
  right: 16px;
  width: min(360px, calc(100vw - 24px));
  max-height: min(72vh, 680px);
  overflow: auto;
  display: none;
  background: linear-gradient(180deg, rgba(13,47,35,.98), rgba(7,31,22,.98));
  border: 1px solid rgba(243,210,122,.35);
  color: var(--as-plus-text);
  border-radius: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.38);
  padding: 12px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.as-module-drawer.open { display: block; }
.as-module-drawer h2 { margin: 4px 4px 10px; font-size: 1.05rem; color: var(--as-plus-gold); }
.as-module-drawer a {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  color: var(--as-plus-text) !important;
  text-decoration: none !important;
  padding: 10px;
  border-radius: 14px;
  border: 1px solid transparent;
}
.as-module-drawer a:hover,
.as-module-drawer a[aria-current="page"] {
  background: rgba(243,210,122,.10);
  border-color: rgba(243,210,122,.25);
}
.as-module-drawer small { color: var(--as-plus-muted); display:block; line-height:1.35; }
.as-module-check { color: var(--as-plus-green); font-weight: 900; }

.as-learning-guide {
  box-sizing: border-box;
  width: min(1120px, calc(100% - 24px));
  margin: 78px auto 18px;
  padding: 18px;
  color: var(--as-plus-text);
  background: linear-gradient(135deg, rgba(7,31,22,.96), rgba(18,60,45,.94));
  border: 1px solid var(--as-plus-border);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(0,0,0,.24);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  direction: ltr;
  text-align: left;
}
.as-learning-guide h2 { margin: 0 0 8px; color: var(--as-plus-gold); font-size: clamp(20px, 3vw, 30px); }
.as-learning-guide p { margin: 6px 0; line-height: 1.62; color: var(--as-plus-muted); }
.as-learning-guide strong { color: var(--as-plus-text); }
.as-learning-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 12px; }
.as-learning-card { background: var(--as-plus-soft); border: 1px solid rgba(243,210,122,.18); border-radius: 18px; padding: 14px; }
.as-learning-card ul { margin: 8px 0 0 20px; padding: 0; line-height: 1.65; }
.as-learning-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 14px; }
.as-learning-actions button,
.as-learning-actions a {
  border: 1px solid rgba(243,210,122,.26);
  background: rgba(255,255,255,.06);
  color: var(--as-plus-text) !important;
  text-decoration: none !important;
  border-radius: 999px;
  padding: 10px 13px;
  font-weight: 900;
  cursor: pointer;
}
.as-learning-actions .primary { background: linear-gradient(135deg, #f3d27a, #c9993f); color: #102117 !important; }
.as-learning-actions .done { background: rgba(34,181,115,.20); border-color: rgba(34,181,115,.45); }

.as-progress-wrap { margin-top: 12px; }
.as-progress-label { display:flex; justify-content:space-between; gap:12px; color:var(--as-plus-muted); font-size:.95rem; }
.as-progress-track { height: 10px; border-radius:999px; overflow:hidden; background: rgba(255,255,255,.08); border: 1px solid rgba(243,210,122,.15); margin-top: 7px; }
.as-progress-bar { height:100%; width:0%; background: linear-gradient(90deg, #22b573, #f3d27a); transition: width .25s ease; }

.as-index-progress {
  margin: 22px 20px 0;
  border: 1px solid rgba(243,210,122,.25);
  background: rgba(0,0,0,.18);
  border-radius: 24px;
  padding: 20px;
  color: var(--as-plus-text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.as-index-progress h2 { color: var(--as-plus-gold); margin: 0 0 8px; }
.as-index-progress p { color: var(--as-plus-muted); }
.as-index-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:14px; }
.as-index-actions a,
.as-index-actions button { border:1px solid rgba(243,210,122,.28); border-radius:999px; padding:10px 14px; color:var(--as-plus-text); background:rgba(255,255,255,.06); text-decoration:none; font-weight:900; cursor:pointer; }
.as-index-actions .primary { background:linear-gradient(135deg,#f3d27a,#c9993f); color:#102117; }
.as-completed-badge { margin-top: 10px; display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:7px 10px; background:rgba(34,181,115,.17); color:#b8ffd2; font-weight:900; border:1px solid rgba(34,181,115,.35); }

.as-page-footer {
  width: min(1120px, calc(100% - 24px));
  margin: 36px auto 110px;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(243,210,122,.20);
  background: rgba(0,0,0,.18);
  color: var(--as-plus-muted);
  text-align: center;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.as-page-footer strong { color: var(--as-plus-gold); }
.as-back-top {
  position: fixed;
  z-index: 99996;
  right: 18px;
  bottom: 76px;
  display: none;
  border: 1px solid rgba(243,210,122,.45);
  background: rgba(13,47,35,.95);
  color: #f8f7ed;
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 900;
  cursor: pointer;
}
.as-back-top.show { display: inline-flex; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(243,210,122,.8) !important;
  outline-offset: 3px !important;
}

@media (max-width: 760px) {
  .as-learning-guide { margin-top: 68px; padding: 15px; }
  .as-learning-grid { grid-template-columns: 1fr; }
  .as-module-menu-button { top: 58px; right: 10px; min-height: 38px; padding: 9px 12px; font-size: 14px; }
  .as-module-drawer { top: 104px; right: 10px; }
  .as-back-top { bottom: 68px; right: 12px; }
  .as-page-footer { margin-bottom: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
  .as-ai-button, .as-ai-panel, .as-home-button, .as-module-menu-button, .as-module-drawer, .as-learning-actions, .as-back-top { display:none !important; }
  .as-learning-guide, .as-page-footer { box-shadow:none; background:white; color:#111; border:1px solid #ccc; }
}

/* Sécurité v11 : masquer les anciens menus intégrés s'il en reste dans une page importée. */
.menu-container,
nav.menu[aria-label="Menu principal"] {
  display: none !important;
}


/* Correctif v14.1 : la page Mots manquants possède un body Tailwind en flex.
   Avec le guide pédagogique ajouté en haut de page, le flex créait deux colonnes
   et rendait la page illisible. On force une mise en page verticale propre. */
html.as-mots-manquants-page body {
  display: block !important;
  align-items: initial !important;
  justify-content: initial !important;
  min-height: 100vh !important;
  padding: 84px 14px 34px !important;
  box-sizing: border-box;
}
html.as-mots-manquants-page .as-learning-guide {
  margin-top: 0 !important;
  margin-bottom: 18px !important;
}
html.as-mots-manquants-page .quiz-container {
  width: min(980px, 100%) !important;
  max-width: 980px !important;
  margin: 0 auto 42px !important;
  box-sizing: border-box;
}
html.as-mots-manquants-page .selector-container {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)) !important;
  gap: 14px !important;
}
html.as-mots-manquants-page #question,
html.as-mots-manquants-page #translation,
html.as-mots-manquants-page #options {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}
html.as-mots-manquants-page #options {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 12px !important;
}
html.as-mots-manquants-page #options.hidden {
  display: none !important;
}
html.as-mots-manquants-page #options > div,
html.as-mots-manquants-page .option-btn {
  width: 100% !important;
  max-width: 100% !important;
}
html.as-mots-manquants-page .option-btn {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.55 !important;
  min-height: 58px;
  text-align: center !important;
  direction: rtl;
}
@media (max-width: 720px) {
  html.as-mots-manquants-page body {
    padding: 108px 10px 30px !important;
  }
  html.as-mots-manquants-page .quiz-container {
    padding: 16px !important;
    border-radius: 20px !important;
  }
  html.as-mots-manquants-page .selector-container {
    grid-template-columns: 1fr !important;
  }
  html.as-mots-manquants-page .question-arabic {
    font-size: 1.35rem !important;
  }
}
