/* === legacy.css === Extrait de styles.css lignes 2000-2978 === */
  min-height: 60%;
}
.chart-placeholder::before {
  content: "📊";
  font-size: 2em;
  margin-bottom: 12px;
}

.content-text h2 {
  font-size: 1.5em;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  text-align: left;
  hyphens: none;
}

.content-text h3 {
  font-size: 1.15em;
  font-weight: 700;
  color: var(--text);
  text-align: left;
  hyphens: none;
}

.content-text p {
  font-size: 1em;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 6px;
}

.content-text strong { font-weight: 700; }

.content-text ul, .content-text ol {
  padding-left: 20px;
  font-size: 1em;
  line-height: 1.7;
  text-align: left;
}

.content-text li { margin-bottom: 3px; }

.content-text table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
  margin: 6px 0;
  text-align: left;
  hyphens: none;
}

.content-text th {
  background: var(--primary);
  color: white;
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
}

.content-text td {
  padding: 8px 12px;
  border-bottom: 1px solid #e0e0e0;
}

.content-text tr:nth-child(even) td { background: #f8f9fa; }

/* Bon à savoir / encart info */
.content-text blockquote {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 0 8px 8px 0;
  font-size: 0.95em;
  margin: 6px 0;
}

.content-text blockquote p { margin: 0; }

/* Spacer: double saut de ligne dans le markdown = espace visuel */
.content-text .spacer { height: 0.6em; }

.content-image {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 32px 36px 20px;
  flex-shrink: 0;
}

.content-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

/* Fade-in global : toutes les images du slide démarrent invisibles */
.slide-body img {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.slide-body img.loaded { opacity: 1; }

/* Pages intro (cartes avec images 16/9) : réserver l'espace avant chargement.
   Cible uniquement les images avec max-width:300px (cartes intro). */
.layout-text-only .content-text img[style*="max-width:300px"] {
  aspect-ratio: 16/9;
}

/* Images inline dans pages composites (HTML custom) : conteneurs flex
   avec taille fixe en inline style → les rendre proportionnels à --text-size
   pour qu'ils réduisent avec autoFitText au lieu de bloquer le layout. */
.content-text div[style*="flex:0 0"] {
  flex-basis: calc(var(--text-size, 16px) * 11.875) !important;
}

/* Placeholder when image not found */
.img-placeholder {
  width: 100%;
  height: 100%;
  min-height: 200px;
  background: var(--gradient-placeholder);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 0.85em;
  opacity: 0.6;
  text-align: center;
  padding: 16px;
}

/* === Shared rules for all image layouts === */
[class*="layout-image-"] .slide-body { flex-direction: row; }
[class*="layout-image-"] .content-image img,
[class*="layout-image-"] .content-image .img-placeholder {
  width: 100%; height: auto; object-fit: cover;
}
/* Image-left: swap padding (image goes left, text right) */
[class*="layout-image-left"] .content-image {
  padding-left: 32px;
  padding-right: 8px;
}

/* === Square: ~50% text / ~50% image === */
.layout-image-right-square .content-text { flex: 0.9; }
.layout-image-right-square .content-image { flex: 0.9; }
.layout-image-left-square .content-text { flex: 0.9; }
.layout-image-left-square .content-image { flex: 0.9; }

/* === Medium: ~60% text / ~40% image === */
.layout-image-right-medium .content-text { flex: 1.3; }
.layout-image-right-medium .content-image { flex: 0.9; }
.layout-image-left-medium .content-text { flex: 1.3; }
.layout-image-left-medium .content-image { flex: 0.9; }

/* === Portrait: ~75% text / ~25% image === */
.layout-image-right-portrait .content-text { flex: 2.5; }
.layout-image-right-portrait .content-image { flex: 1; }
.layout-image-left-portrait .content-text { flex: 2.5; }
.layout-image-left-portrait .content-image { flex: 1; }

/* === Auto (image-right / image-left): base before JS detection === */
.layout-image-right .content-text { flex: 1; }
.layout-image-right .content-image { flex: 0.9; }
.layout-image-left .content-text { flex: 1; }
.layout-image-left .content-image { flex: 0.9; }

/* Transition douce si le layout auto-détecté change après reveal
   (évite un saut brutal quand l'image charge après le timeout) */
[class*="layout-image-"] .content-text,
[class*="layout-image-"] .content-image {
  transition: flex-grow 0.3s ease;
}

/* === Dual: two images side by side on one side === */
.layout-image-right-dual .slide-body { flex-direction: row; }
.layout-image-right-dual .content-text { flex: 1; }
.layout-image-right-dual .content-image {
  flex: 1.1;
  flex-direction: row;
  gap: 12px;
  align-items: stretch;
}
.layout-image-right-dual .content-image img,
.layout-image-right-dual .content-image .img-placeholder {
  flex: 1;
  min-width: 0;
  width: 0;
  height: 100%;
  object-fit: cover;
  border-radius: 14px;
}

/* Layout: text-only */
.layout-text-only .content-text { flex: 1; max-width: 1000px; margin: 0 auto; }
.layout-section-intro .content-text { flex: 1; max-width: 1000px; margin: 0 auto; }

/* Layout: cover (rapport portage) */
#capsule.layout-cover { background: var(--bg); }
.layout-cover .slide-header { display: none; }
.layout-cover .slide-body { flex-direction: column; overflow: hidden; padding: 56px 64px 48px 64px; gap: 24px; }
.layout-cover .content-text {
  flex: 0 0 auto;       /* prend la taille du contenu (sinon collapse à 0 à cause de overflow:hidden + basis 0) */
  padding: 0;
}
.layout-cover .content-text h1 {
  font-size: calc(var(--text-size, 16px) * 2.6);
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 16px;
  line-height: 1.1;
  max-width: 500px;            /* force le wrap sur 2 lignes pour un meilleur impact visuel */
}
.layout-cover .content-text p { font-size: 1em; color: var(--text); line-height: 1.5; max-width: 720px; }
.layout-cover .content-image {
  flex: 1;
  padding: 0;
  align-items: stretch;
  display: flex;
  min-height: 0;
}
.layout-cover .content-image img,
.layout-cover .content-image .img-placeholder {
  border-radius: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Logo OPPS top-right (cover only) */
.layout-cover .cover-logo {
  position: absolute;
  top: 32px;
  right: 40px;
  height: 70px;
  width: auto;
  z-index: 4;
}
/* Bouton CTA : bas-à-droite, en symétrie diagonale avec le logo */
.layout-cover .cover-cta {
  position: absolute;
  bottom: 36px;
  right: 40px;
  z-index: 5;
  background: var(--lfc-corail);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--text-size, 16px) * 1.05);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 20px rgba(232,160,144,0.45);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.layout-cover .cover-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(232,160,144,0.6);
}
.layout-cover .cover-cta span {
  font-size: 1.15em;
  transition: transform 0.2s ease;
}
.layout-cover .cover-cta:hover span {
  transform: translateX(4px);
}

/* Layouts section-intro et section-intro-right : split bicolore avec image portrait
   - section-intro       : image à gauche (saumon), texte à droite (crème) — auto-assigné aux ## sans ###
   - section-intro-right : texte à gauche (saumon), image à droite (crème) */
.layout-section-intro .slide-header,
.layout-section-intro-right .slide-header { display: none; }

.layout-section-intro .slide-body,
.layout-section-intro-right .slide-body {
  flex-direction: row;
  overflow: hidden;
  padding: 0;
  gap: 0;
  position: relative;
}

/* section-intro : image gauche, texte droite */
.layout-section-intro .content-text {
  flex: 1;
  max-width: none;
  margin: 0;
  background: var(--bg-cream);
  padding: 56px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  order: 2;
}
.layout-section-intro .content-image {
  flex: 1.1;
  padding: 56px 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 1;
  background: var(--bg);
}

/* section-intro-right : texte gauche, image droite */
.layout-section-intro-right .content-text {
  flex: 1;
  max-width: none;
  margin: 0;
  background: var(--bg);
  padding: 56px 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  order: 1;
}
.layout-section-intro-right .content-image {
  flex: 1.1;
  padding: 56px 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
  background: var(--bg-cream);
}

/* Common typography & images */
.layout-section-intro .content-text h1,
.layout-section-intro-right .content-text h1 {
  font-size: calc(var(--text-size, 16px) * 2.5);
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}
.layout-section-intro .content-text p,
.layout-section-intro-right .content-text p {
  margin-top: 16px;
  font-size: 1em;
  color: var(--text);
  line-height: 1.6;
}
.layout-section-intro .content-image img,
.layout-section-intro .content-image .img-placeholder,
.layout-section-intro-right .content-image img,
.layout-section-intro-right .content-image .img-placeholder {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Layout: sommaire */
.layout-sommaire .slide-body { flex-direction: row; gap: 0; }
.sommaire-left {
  width: 240px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
}
.sommaire-left h1 { font-size: 2em; margin-bottom: 12px; }
.sommaire-left p { font-size: 0.9em; color: var(--text-light); line-height: 1.5; }
.sommaire-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 14px 28px;
  align-content: center;
  overflow-y: auto;
}
.sommaire-card {
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 250px;
  justify-self: center;
}
.sommaire-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.sommaire-card-img {
  width: 100%;
  aspect-ratio: 16/7.8;
  background: var(--gradient-placeholder);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px 10px 0 0;
}
.sommaire-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sommaire-card-label {
  padding: 0 6px;
  font-size: 0.7em;
  font-weight: 600;
  text-align: center;
  color: var(--text);
  line-height: 1.3;
  height: 2.6em;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Popup buttons --- */
.popup-btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  border: none;
  text-decoration: none;
  padding: 10px 24px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  font-family: var(--font);
  margin-top: 8px;
  transition: background 0.2s;
}
.popup-btn:hover { background: var(--primary-dark); }
p:has(> .popup-btn:only-child) { text-align: center; }

/* Inline interactive markers */
.marker-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--text-size, 16px) * 2.375);
  height: calc(var(--text-size, 16px) * 2.375);
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  cursor: pointer;
  font-size: calc(var(--text-size, 16px) * 0.875);
  font-weight: 700;
  vertical-align: middle;
  transition: transform 0.2s;
}
.marker-btn:hover { transform: scale(1.1); }
.marker-btn-cftc { background: white; border: 2px solid var(--primary); padding: 4px; overflow: hidden; width: calc(var(--text-size, 16px) * 5.625); height: calc(var(--text-size, 16px) * 3.5); border-radius: 10px; }
.marker-btn-cftc img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* --- Marker rows (flex rows inside content-text) --- */
.marker-rows {
  flex: 1;
}
.marker-row {
  display: flex;
  align-items: center;
  padding: 6px 0;
}
.marker-row-text {
  flex: 1;
  padding: 0 20px 0 8px;
}
.marker-row-text p {
  margin: 0;
}
.bullet {
  font-size: 1.6em;
  line-height: 1;
  vertical-align: middle;
  margin-right: 4px;
}
.marker-row-text .spacer {
  display: none;
}
.marker-row-btn {
  flex-shrink: 0;
  padding: 0 24px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.marker-row-btn .popup-btn {
  margin-top: 0;
  white-space: nowrap;
  line-height: 1.2;
  padding: 10px 30px;
  max-width: none;
}
.marker-row:has(.marker-row-text .marker-center) {
  justify-content: center;
  padding-top: 14px;
  padding-bottom: 14px;
}
.marker-row:has(.marker-row-text .marker-center) .marker-row-text {
  display: none;
}
.marker-row:has(.marker-row-text .marker-center) .marker-row-btn {
  padding: 0;
}
.content-text:has(.marker-rows) {
  padding-right: 16px;
}

/* --- Modal --- */
#modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.55);
  display: none;
  z-index: 500;
  align-items: center;
  justify-content: center;
}
#modal-overlay.open { display: flex; }

#modal-content {
  background: white;
  border-radius: 16px;
  max-width: 1000px;
  width: 90%;
  max-height: 80vh;
  overflow: visible;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
#modal-body {
  max-height: 80vh;
  overflow-y: auto;
  padding: 36px 40px;
  border-radius: 16px;
}

#modal-content h1, #modal-content h2, #modal-content h3 {
  font-weight: 700;
  margin-bottom: 12px;
}
#modal-content h1 { font-size: 1.6em; }
#modal-content h2 { font-size: 1.3em; }
#modal-content h3 { font-size: 1.15em; margin-top: 1.2em; }
#modal-content p { line-height: 1.65; margin-bottom: 10px; }
#modal-content ul, #modal-content ol { padding-left: 20px; margin-bottom: 10px; }
#modal-content li { margin-bottom: 4px; line-height: 1.6; }
#modal-content table { width: 100%; border-collapse: collapse; margin: 12px 0; }
#modal-content th { background: var(--primary); color: white; padding: 8px 12px; text-align: left; }
#modal-content td { padding: 8px 12px; border-bottom: 1px solid #e0e0e0; }

#modal-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 36px; height: 36px;
  background: #333;
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
#modal-close:hover { background: #555; }

/* --- Sidebar --- */
#sidebar {
  position: fixed;
  top: 0; left: -340px;
  width: 340px;
  height: 100%;
  background: white;
  z-index: 600;
  transition: left 0.3s ease;
  box-shadow: 4px 0 16px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
}
#sidebar.open { left: 0; }

#sidebar-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.35);
  z-index: 550;
  display: none;
}
#sidebar-overlay.open { display: block; }

#sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e0e0e0;
}

#sidebar-header h2 {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--text);
}

#sidebar-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-light);
  padding: 4px;
}

#sidebar-search {
  margin: 12px 16px;
  padding: 8px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9em;
  font-family: var(--font);
  width: calc(100% - 32px);
}
#sidebar-search:focus { outline: none; border-color: var(--primary); }

#sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.nav-section {
  border-bottom: 1px solid #f0f0f0;
}

.nav-section-title {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9em;
  color: var(--text);
  transition: background 0.15s;
  gap: 8px;
}
.nav-section-title:hover { background: var(--primary-light); }
.nav-section-title .arrow {
  font-size: 0.7em;
  transition: transform 0.2s;
  color: var(--text-light);
}
.nav-section-title.expanded .arrow { transform: rotate(90deg); }

.nav-pages {
  display: none;
  padding: 0 0 4px 0;
}
.nav-pages.open { display: block; }

.nav-subsection {
  padding: 6px 20px 3px 32px;
  font-size: 0.75em;
  font-weight: 600;
  color: var(--primary);
}

.nav-page {
  padding: 7px 20px 7px 40px;
  cursor: pointer;
  font-size: 0.85em;
  color: var(--text-light);
  transition: all 0.15s;
  border-left: 3px solid transparent;
}
.nav-page:hover { background: var(--primary-light); color: var(--text); }
.nav-page.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
  border-left-color: var(--primary);
}

/* --- Admin mode --- */
.admin-indicator {
  position: fixed;
  top: 8px; right: 8px;
  background: #e74c3c;
  color: white;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.75em;
  font-weight: 600;
  z-index: 700;
  display: none;
}
.admin-mode .admin-indicator { display: block; }

#admin-toolbar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #2c3e50;
  color: white;
  padding: 8px 16px;
  border-radius: 25px;
  display: none;
  z-index: 700;
  gap: 8px;
  align-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  font-size: 0.85em;
}
.admin-mode #admin-toolbar { display: flex; }

#admin-toolbar button {
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.9em;
  font-weight: 500;
  transition: background 0.2s;
}
#admin-toolbar button:hover { background: rgba(255,255,255,0.25); }
#admin-toolbar .btn-save { background: #27ae60; }
#admin-toolbar .btn-save:hover { background: #2ecc71; }

/* Admin editable zones */
.admin-mode .content-text[data-editable] {
  cursor: text;
  outline: 2px dashed rgba(26, 95, 166, 0.3);
  outline-offset: 4px;
  border-radius: 4px;
}
.admin-mode .content-text[data-editable]:hover {
  outline-color: rgba(26, 95, 166, 0.6);
}

/* Admin: image change overlay */
.admin-mode .content-image { position: relative; }
.img-change-overlay {
  display: none;
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.45);
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.img-change-overlay:hover { background: rgba(0,0,0,0.6); }
.admin-mode .content-image .img-change-overlay { display: flex; }
.img-change-overlay span {
  color: white;
  font-size: 0.85em;
  font-weight: 600;
}
.img-change-overlay .img-change-icon {
  font-size: 2em;
  color: white;
}
.admin-mode .sommaire-card { position: relative; }
.admin-mode .sommaire-card .img-change-overlay { display: flex; }
.admin-mode .sommaire-card .img-change-overlay .img-change-icon { font-size: 1.2em; }
.admin-mode .sommaire-card .img-change-overlay span { font-size: 0.7em; }

/* --- Editor panel (bottom drawer) --- */
#editor-panel {
  position: fixed;
  bottom: -45%;
  left: 0;
  width: 100%;
  height: 45%;
  background: #1e1e1e;
  z-index: 800;
  transition: bottom 0.3s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.4);
}
#editor-panel.open { bottom: 0; }

/* Quand l'editeur est ouvert, remonter la capsule */
body.editor-open #capsule {
  transform: translateY(-22%);
  transition: transform 0.3s ease;
}

#editor-header {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  background: #2d2d2d;
  gap: 8px;
  flex-shrink: 0;
}

#editor-header span {
  color: #ccc;
  font-size: 0.85em;
  font-weight: 600;
}

#editor-header .editor-hint {
  color: #888;
  font-size: 0.75em;
  font-weight: 400;
  font-style: italic;
}

#editor-header button {
  background: rgba(255,255,255,0.1);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8em;
}
#editor-header button:hover { background: rgba(255,255,255,0.2); }
#editor-header .btn-apply { background: #27ae60; }
#editor-header .btn-apply:hover { background: #2ecc71; }
#editor-header .editor-spacer { flex: 1; }

#editor-textarea {
  flex: 1;
  background: #1e1e1e;
  color: #d4d4d4;
  border: none;
  padding: 16px 20px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
}

/* --- Loading --- */
#loading {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--primary);
  font-size: 1.1em;
}

/* --- Side navigation arrows --- */
.side-arrow {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.side-arrow:hover { background: rgba(255,255,255,0.35); color: #fff; border-color: rgba(255,255,255,0.8); }
.side-arrow svg { width: 28px; height: 28px; fill: currentColor; }
.side-arrow[hidden] { display: none; }

/* ============================================================
   Mobile landscape: scale-to-fit (like Genially)
   The capsule renders at a fixed 1200×675 "design size" and is
   scaled down uniformly via transform: scale() to fit the viewport.
   ============================================================ */
@media (max-height: 500px) {
  #capsule {
    width: 1200px;
    height: 675px;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(var(--mobile-scale, 0.55));
    border-radius: 20px;
  }
}

/* ============================================================
   Mobile portrait: overlay "rotate your phone"
   ============================================================ */
#portrait-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--primary, #1a5fa6);
  z-index: 9999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: white;
  font-family: var(--font);
}
#portrait-overlay svg {
  width: 64px; height: 64px;
  fill: white;
  animation: rotatePhone 2s ease-in-out infinite;
}
#portrait-overlay p {
  font-size: 1.1em;
  font-weight: 600;
  text-align: center;
  padding: 0 32px;
}
@keyframes rotatePhone {
  0%, 100% { transform: rotate(0deg); }
  25%, 75% { transform: rotate(90deg); }
}

@media (orientation: portrait) and (max-width: 600px) {
  #portrait-overlay { display: flex; }
}

/* --- Auth modal (capsules protégées par mot de passe) --- */
#auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 95, 166, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: 'Raleway', sans-serif;
}
#auth-modal.active { display: flex; }
#auth-box {
  background: white;
  border-radius: 16px;
  padding: 40px 36px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
}
#auth-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: 10px;
}
#auth-subtitle {
  font-size: 14px;
  color: #555;
  margin-bottom: 22px;
  line-height: 1.5;
}
#auth-form { display: flex; flex-direction: column; gap: 12px; }
#auth-password {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  font-family: 'Raleway', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
#auth-password:focus { border-color: var(--primary); }
#auth-submit {
  padding: 12px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: 'Raleway', sans-serif;
  transition: background 0.2s;
}
#auth-submit:hover:not(:disabled) { background: var(--primary-dark); }
#auth-submit:disabled { opacity: 0.6; cursor: not-allowed; }
#auth-error {
  color: #c53030;
  font-size: 13px;
  min-height: 18px;
  margin-top: 2px;
}

