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

:root {
  --bg: #0c0c10;
  --bg-soft: #15151c;
  --gold: #f0b93d;
  --gold-soft: #3a2f14;
  --text: #f2eee4;
  --text-dim: #9a968c;
  --danger: #e2554a;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  scroll-behavior: smooth;
}

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  /* Volontairement au-dessus de .menu-stack (z-index: 30) : même valeur avant
     ce correctif, donc l'ordre dans le HTML départageait les zones qui se
     chevauchent - .menu-stack, placé après dans le document, passait par-dessus
     et volait une partie des clics destinés au logo/À propos/... du bandeau
     du haut. Le bandeau de contrôles doit toujours gagner. */
  z-index: 31;
  pointer-events: none;
}

.topbar > * { pointer-events: auto; }

.title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
}

.breadcrumb {
  position: relative;
  top: -3.6vw;
  left: 0;
  z-index: 1;
  display: flex;
  align-items: center;
}

.breadcrumb-bubble {
  width: auto;
  white-space: nowrap;
  text-align: left;
  padding: 6vw 15vw;
  font-size: 10.5vw;
}

.blob {
  position: relative;
  top: -2.4vw;
  left: -3vw;
  width: 27vw;
  z-index: 2;
  box-sizing: border-box;
  padding: 3.75vw 2.55vw 2.4vw 5.7vw;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  background: none;
  border: none;
}

/* Forme organique portée par un calque décoratif séparé (::before), pas par
   le bouton lui-même : la zone cliquable de .blob reste le rectangle complet
   (défini par padding ci-dessus), même si le fond visuel, lui, est découpé/
   arrondi de façon très asymétrique. Sans ça, les coins "mordus" par ce
   border-radius extrême pouvaient donner l'impression - ou, selon le
   navigateur/l'appareil, provoquer réellement - une zone non cliquable. */
.blob::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--gold-soft);
  border: 1px solid rgba(240, 185, 61, 0.35);
  border-radius: 63% 37% 54% 46% / 43% 51% 49% 57%;
}

.brand {
  display: inline-block;
  font-size: 3vw;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--gold);
}

.corner-actions {
  display: flex;
  align-items: center;
  gap: 0.9vw;
  margin: 1.65vw 2.25vw 0 0;
}

.account-name {
  font-size: 0.9vw;
  color: var(--text-dim);
  white-space: nowrap;
}

.icon-btn {
  position: relative;
  width: 2.85vw;
  height: 2.85vw;
  color: var(--text);
  font-size: 1.5vw;
  line-height: 1;
  cursor: pointer;
  background: none;
  border: none;
}

/* Même principe que .blob::before : le rond visuel est décoratif, la zone
   cliquable réelle de .icon-btn reste le carré complet (width/height
   ci-dessus) - un petit bouton rond a, en proportion, les coins "perdus"
   les plus grands (~21% du carré), donc le plus sensible à ce souci. */
.icon-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  border: 1px solid rgba(240, 185, 61, 0.35);
  background: var(--bg-soft);
  transition: border-color 0.25s ease;
}

.icon-btn:hover::before {
  border-color: var(--gold);
}

.options-menu {
  position: fixed;
  top: 60px;
  right: 28px;
  background: var(--bg-soft);
  border: 1px solid rgba(240, 185, 61, 0.35);
  border-radius: 10px;
  padding: 6px;
  z-index: 40;
}

.options-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
}

/* "display: block" ci-dessus a une spécificité plus forte que la règle par
   défaut du navigateur pour [hidden] (display: none) - sans cette ligne,
   les boutons masqués par le JS (hidden = true) restent visibles. */
.options-menu button[hidden] {
  display: none;
}

.options-menu button:hover {
  background: rgba(240, 185, 61, 0.12);
}

.options-menu button.danger-text {
  color: #b3261e;
}

.options-menu button.danger-text:hover {
  background: rgba(179, 38, 30, 0.1);
}

.menu-stack {
  position: fixed;
  top: 3.15vw;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9vw;
  z-index: 30;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.menu-stack.menu-hidden {
  transform: translateY(-30vw);
  opacity: 0;
  pointer-events: none;
}

.menu-row {
  display: flex;
  justify-content: center;
  gap: 0.9vw;
}

.menu-item {
  position: relative;
}

.submenu-preview {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  background: var(--bg-soft);
  border: 1px solid rgba(240, 185, 61, 0.35);
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  z-index: 35;
}

.submenu-preview button {
  background: none;
  border: none;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.submenu-preview button:hover {
  background: rgba(240, 185, 61, 0.12);
  color: var(--gold);
}

.bubble {
  border: 1px solid rgba(240, 185, 61, 0.35);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 0.9vw 1.5vw;
  font-size: 1.125vw;
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.bubble:hover {
  border-color: var(--gold);
  box-shadow: 0 0 12px rgba(240, 185, 61, 0.25);
}

.bubble.active {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold);
}

.menu-bubble {
  padding: 0.9vw 1.65vw;
  font-size: 1.05vw;
}

main {
  position: relative;
  z-index: 10;
  /* Laisse la place au bandeau du haut (logo, menu de navigation), en
     position fixed donc superposé au contenu sans ça - seule la toute
     première section en a besoin, mais c'est plus simple à régler ici une
     fois qu'en répétant un espace sur chaque section. */
  padding-top: 10vw;
}

.screen {
  position: relative;
  /* "min" et non une hauteur fixe : une section grandit toujours si son
     contenu (texte long, image ajoutée) a besoin de plus de place - ça ne
     réduit que la hauteur par défaut, vide. */
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4.05vw;
  padding: 3vw 5.25vw;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.screen.reverse {
  flex-direction: row-reverse;
}

.screen-blob {
  flex-shrink: 0;
  width: 26%;
  max-width: 21vw;
  min-width: 15.75vw;
  height: 15.75vw;
  background: var(--gold-soft);
  border: 1px solid rgba(240, 185, 61, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.35vw;
  text-align: center;
}

.screen-blob h1 {
  margin: 0;
  font-size: 2.1vw;
  font-weight: 600;
  color: var(--gold);
}

.screen-text {
  flex: 1;
  max-width: 51vw;
}

.screen-text p {
  color: var(--text-dim);
  font-size: 1.35vw;
  line-height: 1.6;
}

/* --- blocs de contenu (constructeur) ---------------------------------- */

.content-block {
  position: relative;
}

.content-block-button {
  display: inline-block;
}

.content-block-controls {
  display: inline-flex;
  gap: 4px;
  margin: 2px 0 10px 8px;
  vertical-align: middle;
}

.content-block-paragraph .content-block-controls {
  display: flex;
  margin: 2px 0 10px;
}

.block-ctrl-btn {
  border: 1px solid rgba(240, 185, 61, 0.3);
  background: var(--bg-soft);
  color: var(--text-dim);
  border-radius: 6px;
  width: 22px;
  height: 22px;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.block-ctrl-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.block-ctrl-btn.danger {
  color: var(--danger);
  border-color: rgba(226, 85, 74, 0.4);
}

.add-block-row {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 12px;
}

.add-block-btn {
  border: 1px dashed rgba(240, 185, 61, 0.4);
  background: none;
  color: var(--text-dim);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.add-block-btn:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* --- réorganisation des bulles (glisser-déposer) ---------------------- */

.reorder-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reorder-item {
  border: 1px solid rgba(240, 185, 61, 0.3);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: grab;
}

.reorder-item.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.admin-controls {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.admin-controls button {
  border: 1px solid rgba(240, 185, 61, 0.35);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
}

.admin-controls button.danger {
  border-color: rgba(226, 85, 74, 0.5);
  color: var(--danger);
}

.screen-link {
  display: inline-block;
  margin-top: 16px;
  background: none;
  border: none;
  color: var(--gold);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fab {
  position: fixed;
  bottom: 2.4vw;
  right: 2.4vw;
  width: 4.35vw;
  height: 4.35vw;
  border-radius: 50%;
  border: 1px solid rgba(240, 185, 61, 0.5);
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 2.1vw;
  cursor: pointer;
  z-index: 40;
}

.fab-reorder {
  right: auto;
  left: 2.4vw;
  width: 3.6vw;
  height: 3.6vw;
  font-size: 1.6vw;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  width: 340px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid rgba(240, 185, 61, 0.35);
  border-radius: 14px;
  padding: 22px;
}

.modal h2 {
  color: var(--gold);
  font-size: 18px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--gold);
}

.modal label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin: 12px 0 6px;
}

.modal input[type="text"],
.modal input[type="password"],
.modal textarea,
.modal select {
  width: 100%;
  background: var(--bg);
  border: 1px solid rgba(240, 185, 61, 0.25);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
}

.modal-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin: 12px 0 0;
  line-height: 1.5;
}

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  font-size: 13px !important;
  color: var(--text) !important;
}

.checkbox-label input { width: auto; }

.shape-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.shape-preview {
  width: 56px;
  height: 56px;
  background: var(--gold-soft);
  border: 1px solid rgba(240, 185, 61, 0.35);
  flex-shrink: 0;
}

.modal-error {
  color: var(--danger);
  font-size: 12px;
  margin-top: 8px;
}

.link-toggle {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-toggle:hover {
  color: var(--gold);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.modal-actions button {
  border: 1px solid rgba(240, 185, 61, 0.35);
  background: var(--bg);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
}

.modal-actions button#formSave,
.modal-actions button#authSubmit,
.modal-actions button#blockSave {
  background: var(--gold-soft);
  color: var(--gold);
  border-color: var(--gold);
}

.modal-actions button.danger {
  margin-right: auto;
  border-color: rgba(226, 85, 74, 0.5);
  color: var(--danger);
}

/* --- images de section (admin) ------------------------------------- */

.add-image-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(240, 185, 61, 0.35);
  background: var(--bg-soft);
  color: var(--gold);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  z-index: 20;
}

.add-image-btn:hover {
  border-color: var(--gold);
}

.bubble-image-wrap {
  position: absolute;
  z-index: 5;
}

.bubble-image-wrap img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Mode admin, avant activation : simple indice au survol qu'on peut cliquer
   pour modifier - pas de cadre ni de contrôles tant que ce n'est pas activé. */
.bubble-image-wrap.editable {
  cursor: pointer;
}
.bubble-image-wrap.editable:hover {
  outline: 1px dashed rgba(240, 185, 61, 0.35);
  outline-offset: 4px;
}

/* Mode admin, activé (après un clic sur l'image) : cadre plus marqué,
   déplacement/redimensionnement possibles, contrôles visibles. */
.bubble-image-wrap.editable.editing {
  cursor: move;
  outline: 1px dashed rgba(240, 185, 61, 0.6);
  outline-offset: 4px;
}

/* Transparence uniquement PENDANT un déplacement/redimensionnement actif -
   redevient pleinement opaque dès que le geste se termine et est enregistré. */
.bubble-image-wrap.placing img {
  opacity: 0.6;
}

.bubble-image-handle,
.bubble-image-delete,
.bubble-image-validate {
  display: none;
}
.bubble-image-wrap.editing .bubble-image-handle,
.bubble-image-wrap.editing .bubble-image-delete,
.bubble-image-wrap.editing .bubble-image-validate {
  display: block;
}

.bubble-image-handle {
  position: absolute;
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 1px solid var(--bg);
  cursor: nwse-resize;
}

.bubble-image-delete {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(226, 85, 74, 0.5);
  background: var(--bg-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.bubble-image-validate {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(240, 185, 61, 0.5);
  background: var(--bg-soft);
  color: var(--gold);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

/* --- popup d'ajout d'image ------------------------------------------ */

.image-dropzone {
  border: 2px dashed rgba(240, 185, 61, 0.35);
  border-radius: 10px;
  padding: 24px 12px;
  text-align: center;
  cursor: pointer;
  color: var(--text-dim);
  font-size: 13px;
}

.image-dropzone.drag-over {
  border-color: var(--gold);
  color: var(--gold);
}

.image-dropzone img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 6px;
}
