body{
  margin:0;
  font-family: system-ui, sans-serif;
  background:#0f1618;
  color:#fff;
}

:root{
  --cv-media-max-h: 420px;
  --cv-media-fit-width: 760px;
}

html, body{ transform: none !important; }
body.cv-modal-open{
  overflow:hidden;
}
.cv-top{
  position: sticky;
  top: 0;
  z-index: 50;
  background:#0c1214;
  padding:14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.cv-top-inner{
  display:flex;
  align-items:center;
  gap:12px;
  min-width: 0;
}
.cv-cours-btn{
  flex-shrink: 0;
  border:0;
  background: rgba(255,255,255,.15);
  color:#fff;
  font-weight:900;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  cursor:pointer;
  line-height: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 18px;
}
.cv-cours-btn:hover{ background: rgba(255,255,255,.25); }
/* Retour aux cours (bouton 📚) */
.cv-back-btn{
  flex-shrink: 0;
  text-decoration: none;
  border:0;
  background: rgba(255,255,255,.10);
  color:#fff;
  font-weight:900;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  cursor:pointer;
  line-height: 1;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 18px;
}
.cv-back-btn:hover{ background: rgba(255,255,255,.18); }
.cv-h1{
  margin:0;
  font-size:1.2rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  min-width: 0;
  flex: 1;
}
.cv-counter{
  flex-shrink: 0;
  opacity: .8;
  font-weight: 800;
  background: rgba(255,255,255,.10);
  padding: 6px 10px;
  border-radius: 12px;
  font-size: .95rem;
}

/* Visibilité élève (prof/admin) */
.cv-vis-btn{
  flex-shrink:0;
  border:0;
  background: rgba(255,255,255,.10);
  color:#fff;
  font-weight:900;
  width: 52px;
  height: 42px;
  border-radius: 14px;
  cursor:pointer;
  line-height:1;
  display:flex;
  align-items:center;
  justify-content:center;
  position: relative;
}
.cv-vis-btn:hover{ background: rgba(255,255,255,.18); }
.cv-vis-btn .cv-eye{ font-size: 18px; }

/* oeil barré quand masqué */
.cv-vis-btn.is-hidden .cv-eye{ opacity:.55; }
.cv-vis-btn.is-hidden::after{
  content:"";
  position:absolute;
  width:2px;
  height:28px;
  background: rgba(255,255,255,.7);
  transform: rotate(45deg);
  border-radius: 999px;
}


/* wrapper global */
/* =========================
   MENU COMPACT & CENTRÉ
========================= */

/* wrapper global */
.menu-scroll-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
  background: #2e414577;
  padding: 6px 8px;          /* ↓ réduit fortement la hauteur */
  margin-top: 6px;           /* rapproche du header */
  border-radius: 16px;
}

/* zone scrollable */
.menu-scroll {
  position: relative;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 1;
  z-index: 1;
  padding: 0;                /* supprime le padding vertical inutile */
}
.menu-scroll::-webkit-scrollbar { display: none; }

/* conteneur icônes */
#menu {
  display: flex;
  gap: clamp(14px, 2.5vw, 24px);
  padding: 4px 10px;         /* ↓ énorme réduction ici */
  justify-content: flex-start;
  align-items: center;
  position: relative;
  z-index: 2;
}

/* ligne centrale alignée exactement au milieu des ronds */
#menu-line {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0;
  right: 0;
  height: 3px;               /* plus fine */
  background: rgba(255,255,255,.35);
  z-index: 0;
  pointer-events: none;
  border-radius: 999px;
}

/* boutons ronds */
#menu button {
  font-size: 22px !important;

  width: 44px !important;    /* ↓ un peu plus compact */
  height: 44px !important;
  border-radius: 999px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 !important;
  line-height: 1 !important;

  background: #fff;
  border: 2px solid rgba(255,255,255,.55);
  flex-shrink: 0;
  z-index: 1;
  cursor: pointer;
  position: relative;
  overflow: visible;
}

.cv-menu-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.cv-menu-audio-indicator{
  position:absolute;
  right:-4px;
  bottom:-4px;
  width:18px;
  height:18px;
  border-radius:999px;
  background:#0c1214;
  color:#fff;
  font-size:10px;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 0 0 2px #fff;
}

#menu button.active{
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,.55) !important;
}

/* flèches scroll */
.scroll-btn {
  position: relative;
  z-index: 50;
  pointer-events: auto;
  background: #000;
  color: #fff;
  border: none;
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}
.scroll-btn:hover{ background:#111; }

@media (max-width: 600px) {
  #menu button {
    width: 40px !important;
    height: 40px !important;
    font-size: 20px !important;
  }

  .scroll-btn {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }
}

/* Drawer */
.cv-drawer{
  position:absolute;
  top: 64px;
  left: 0;
  width:min(380px, 94vw);
  background:#fff;
  color:#111;
  border-radius:0 16px 16px 0;
  box-shadow:16px 16px 30px rgba(0,0,0,.25);
  transform: translateX(-102%);
  transition: transform .25s ease;
  z-index: 9999;
  pointer-events: auto;
  overflow: hidden;
}
.cv-drawer.open{ transform: translateX(0); }

.cv-drawer-head{
  display:flex;
  gap:8px;
  padding:10px 12px;
  border-bottom: 1px solid rgba(0,0,0,.08);
  background: #f7f7f7;
}
.cv-tab{
  border:0;
  background: rgba(0,0,0,.06);
  padding:8px 10px;
  border-radius: 12px;
  cursor:pointer;
  font-weight: 800;
}
.cv-tab.active{
  background: rgba(30,144,255,.14);
  outline: 2px solid rgba(30,144,255,.25);
}
.cv-drawer-body{
  padding: 8px 10px 12px;
  max-height: min(72vh, 560px);
  overflow:auto;
}
.cv-panel.hidden{ display:none; }

.cv-drawer-item{
  display:flex;
  align-items:center;
  gap:10px;
  justify-content:space-between;
  padding:12px 10px;
  border-radius:12px;
  text-decoration:none;
  color:#111;
}
.cv-drawer-main{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
  flex:1;
}
.cv-drawer-item:hover{ background: rgba(0,0,0,.06); }
.cv-drawer-item.active{
  background: rgba(30,144,255,.12);
  outline: 2px solid rgba(30,144,255,.25);
}
.cv-drawer-ico{ width: 26px; text-align:center; }
.cv-drawer-audio{
  flex-shrink:0;
  opacity:.85;
  font-size:12px;
}
.cv-drawer-txt{
  overflow:hidden;
  white-space:nowrap;
  text-overflow: ellipsis;
}

/* Main / diapo */
.cv-main{ padding: 16px 14px 70px; }
.cv-muted{ opacity:.8; }
.cv-article{ display:none; }
.cv-article.is-active{
  display:block;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 16px;
  padding: 14px 14px;
  margin: 12px 0;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}
.cv-article h2{
  margin: 0 0 10px;
  font-size: 1.05rem;
  display:flex;
  align-items:center;
  gap: 10px;
}
.cv-h2-text{
  min-width:0;
  flex:1;
}
.cv-h2-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: rgba(255,255,255,.10);
}
.cv-audio-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:28px;
  height:28px;
  border-radius:999px;
  background: rgba(66, 153, 225, .18);
  border: 1px solid rgba(147, 197, 253, .35);
  font-size: 13px;
  flex-shrink:0;
}
.cv-untitled{
  display:flex;
  align-items:center;
  gap: 10px;
  font-weight: 700;
  opacity: .9;
  margin-bottom: 10px;
}
.cv-text{ line-height: 1.45; opacity: .95; }
.cv-img{
  max-width: 100%;
  border-radius: 14px;
  display:block;
  width:100%;
  height:100%;
  object-fit:contain;
}
.cv-media-shell{
  width:min(100%, 980px);
  margin: 12px auto;
}
.cv-media-toolbar{
  display:flex;
  justify-content:flex-end;
  margin-bottom:8px;
}
.cv-media-expand{
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color:#fff;
  padding:8px 12px;
  border-radius:999px;
  font-weight:700;
  font-size:.88rem;
  cursor:pointer;
}
.cv-media-expand:hover{
  background: rgba(255,255,255,.14);
}
.cv-media-stage{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  overflow:hidden;
  border-radius:14px;
  background: rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.08);
}
.cv-media-stage-image{
  min-height:220px;
  height: var(--cv-media-max-h);
  max-height: 65vh;
}
.cv-media-stage-video{
  min-height:0;
  background: transparent;
  border:0;
}
.cv-block-media{
  margin: 0 0 14px;
}
.cv-block-media .cv-img,
.cv-block-media .cv-video,
.cv-block-media .cv-embed{
  margin: 0 auto;
}
.cv-pre{
  white-space: pre-wrap;
  background: rgba(0,0,0,.35);
  border-radius: 14px;
  padding: 12px;
  overflow:auto;
}

/* navigation bas */
#navigation {
  position: fixed !important;
  bottom: 0;
  left: 50%;
  width: 100%;
  background: #000;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 5px 0;
  z-index: 100;
  transform: translateX(-50%);
}
#navigation button {
  font-size: 1.2rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #222;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
#navigation button:hover{ background:#2a2a2a; }
@media (max-width: 600px) {
  #navigation button { font-size: 1rem; width: 28px; height: 28px; }
}


/* Embeds */
.cv-embed{
  position:relative;
  width:min(100%, var(--cv-media-fit-width));
  max-width:980px;
  margin: 0 auto;
  aspect-ratio: 16/9;
  background: rgba(0,0,0,.05);
  border-radius: 14px;
  overflow:hidden;
}
.cv-embed iframe{
  position:absolute; inset:0;
  width:100%; height:100%;
  border:0;
}
.cv-video{
  width:min(100%, var(--cv-media-fit-width));
  max-width:980px;
  height:auto;
  max-height: var(--cv-media-max-h);
  display:block;
  margin: 0 auto;
  border-radius:14px;
  background: rgba(0,0,0,.05);
  object-fit:contain;
}
/* QCM (iframe) */
.cv-qcm-frame-wrap{
  width:100%;
  max-width:980px;
  margin: 12px auto;
  border-radius:14px;
  overflow:hidden;
  background: rgba(0,0,0,.03);
  border:1px solid rgba(255,255,255,.08);
}
.cv-qcm-frame{
  width:100%;
  height: 72vh;
  min-height: 520px;
  border:0;
  display:block;
  background: transparent;
}
@media (max-width: 600px){
  .cv-qcm-frame{
    height: 78vh;
    min-height: 480px;
  }
}


/* PDF */
.cv-pdf{
  width:100%;
  max-width:980px;
  margin: 12px auto;
  border-radius:14px;
  overflow:hidden;
  background: rgba(0,0,0,.03);
  border:1px solid rgba(0,0,0,.08);
}
.cv-pdf iframe{
  width:100%;
  height: 70vh;
  border:0;
  display:block;
}

.cv-media-modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:1000000;
}
.cv-media-modal.open{
  display:block;
}
.cv-media-modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(6, 10, 12, .86);
  backdrop-filter: blur(6px);
}
.cv-media-modal-dialog{
  position:relative;
  z-index:1;
  width:min(96vw, 1400px);
  max-height: calc(100dvh - 32px);
  margin:16px auto;
  padding:14px;
  border-radius:18px;
  background:#081013;
  border:1px solid rgba(255,255,255,.09);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.cv-media-modal-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}
.cv-media-modal-title{
  font-weight:800;
  min-height:1.2em;
}
.cv-media-modal-close{
  border:1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color:#fff;
  width:40px;
  height:40px;
  border-radius:999px;
  cursor:pointer;
}
.cv-media-modal-body{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height: min(72dvh, 420px);
  max-height: calc(100dvh - 110px);
}
.cv-media-modal-image,
.cv-media-modal-video{
  width:100%;
  max-width:100%;
  max-height: calc(100dvh - 120px);
  border-radius:14px;
  object-fit:contain;
  background:#000;
}
.cv-media-modal-frame{
  width:min(100%, 1200px);
  max-width:100%;
  aspect-ratio:16/9;
  max-height: calc(100dvh - 140px);
  background:#000;
  border-radius:14px;
  overflow:hidden;
}
.cv-media-modal-frame iframe{
  width:100%;
  height:100%;
  border:0;
}

@media (max-width: 760px){
  .cv-media-shell{
    width:100%;
  }
  .cv-media-stage-image{
    min-height:180px;
  }
  .cv-media-expand{
    padding:7px 10px;
    font-size:.82rem;
  }
  .cv-media-modal-dialog{
    width:calc(100vw - 12px);
    margin:6px auto;
    padding:10px;
  }
}
/* Mode diapo : un seul article visible */
.cv-article { 
  display: none !important; 
}
.cv-article.is-active { 
  display: block !important; 
}

/* Badge (liste cours) */
.cv-badge{ display:inline-block; margin-left:6px; opacity:.85; font-size:12px; }

/* ==========================================================
   Mascotte "avion" (TTS) — bas droite
   - spritesheet 12 frames (1 seule image)
   - animé uniquement quand "parle"
   ========================================================== */
#cvMascot{
  position: fixed !important;
  right: 12px !important;
  bottom: calc(58px + env(safe-area-inset-bottom)) !important; /* au-dessus de la barre nav */
  width: 132px;
  height: 84px;
  z-index: 99999 !important;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.35));
  overflow: hidden;
}

#cvMascot:focus{ outline: 2px solid rgba(59,130,246,.55); outline-offset: 4px; border-radius: 16px; }

#cvMascotSprite{
  will-change: background-position;
  /* On travaille en pixels natifs du spritesheet pour éviter le "glissement" Safari */
  width: 180px;
  height: 112px;
  transform: scale(0.7333333);
  transform-origin: top left;
  background-image: url("/assets/mascot/plane_talk_spritesheet_12.webp");
  background-repeat: no-repeat;
  background-size: 2160px 112px; /* 12 x 180px */
  background-position: 0px 0px;
}

#cvMascot.talking #cvMascotSprite{
  will-change: background-position;
  animation: cvPlaneTalk .9s steps(12) infinite;
}

@keyframes cvPlaneTalk{
  from { background-position: 0px 0px; }
  to   { background-position: -2160px 0px; }
}

/* Badge AUTO */
#cvMascotBadge{
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 3px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .4px;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.14);
  color: #fff;
  display: none;
}
#cvMascot.auto #cvMascotBadge{ display: inline-block; }

/* Sur mobile : un peu plus petit */
@media (max-width: 600px){
  #cvMascot{ width: 112px; height: 72px; right: 10px; bottom: calc(56px + env(safe-area-inset-bottom)); }
}
