/* =====================================================================
   L'Aventure Flibustier : habillage du compte (proposition + panneau).
   =====================================================================
   Feuille autonome, greffée par-dessus app.css. Elle n'y touche pas :
   toutes les classes portent le préfixe « cpt- », et toutes les couleurs
   viennent des tokens d'app.css (pétrole, menthe, blanc), donc le thème clair
   et le contraste renforcé suivent tout seuls.

   Étages (z-index) : proposition 420, fenêtre modale 500, petit mot 520.
   Au-dessus de la visite guidée (400) d'app.css, mais la proposition ne
   s'affiche jamais pendant la visite : compte.js s'en assure.
   ===================================================================== */

/* ---------- Boutons (même squish que .btn d'app.css) ---------- */
.cpt-btn {
  --cpt-edge: 4px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .03em;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 var(--cpt-edge) 0 var(--brand-edge);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.cpt-btn:active {
  transform: translateY(var(--cpt-edge));
  box-shadow: 0 0 0 var(--brand-edge);
  transition-duration: .034s;
}
.cpt-btn:disabled { opacity: .45; transform: none; cursor: default; }
.cpt-btn--or { background: var(--gold); color: var(--on-accent); box-shadow: 0 var(--cpt-edge) 0 var(--gold-deep); }
.cpt-btn--or:active { box-shadow: 0 0 0 var(--gold-deep); }
:root[data-theme="light"] .cpt-btn--or { color: #fff; }
.cpt-btn--fantome {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--line);
}
.cpt-btn--fantome:active { box-shadow: inset 0 0 0 2px var(--line); transform: translateY(2px); }
.cpt-btn--mini { min-height: 44px; font-size: .88rem; padding: 10px 16px; }
.cpt-btn--tiers {
  background: var(--panel);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line), 0 3px 0 var(--panel-3);
  font-weight: 700;
  letter-spacing: 0;
}
.cpt-btn--tiers:active { box-shadow: inset 0 0 0 1px var(--line), 0 0 0 var(--panel-3); }
.cpt-btn--tiers svg { width: 20px; height: 20px; flex: none; }

/* ---------- La proposition (après une île conquise) ---------- */
.cpt-proposition {
  position: fixed; z-index: 420;
  left: 50%; bottom: 0;
  width: min(460px, calc(100vw - 20px));
  transform: translate(-50%, 110%);
  background: var(--panel);
  border: 2px solid color-mix(in srgb, var(--gold) 55%, var(--line));
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 -14px 40px var(--shadow);
  color: var(--ink);
  transition: transform .32s cubic-bezier(.2, 0, 0, 1);
}
.cpt-proposition--vue { transform: translate(-50%, 0); }
.cpt-prop-sur {
  display: flex; align-items: center; gap: 7px;
  font-size: .72rem; font-weight: 800;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}
.cpt-prop-sur svg { width: 16px; height: 16px; flex: none; }
.cpt-prop-titre { font-size: 1.22rem; font-weight: 800; margin: 0 0 8px; line-height: 1.25; }
.cpt-prop-texte { font-size: .93rem; line-height: 1.5; margin: 0 0 8px; color: var(--ink); }
.cpt-prop-libre { color: var(--ink-dim); font-size: .88rem; margin-bottom: 14px; }
.cpt-proposition .cpt-btn + .cpt-btn { margin-top: 9px; }
.cpt-plustard {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 8px 4px;
  background: none; border: none;
  font: inherit;
  color: var(--ink-dim);
  font-size: .85rem; font-weight: 700;
  text-decoration: underline; text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- La croix de fermeture ---------- */
.cpt-croix {
  width: 38px; height: 38px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: 11px;
  background: none; border: none;
  color: var(--ink-dim);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.cpt-croix svg { width: 18px; height: 18px; }
.cpt-croix:active { color: var(--ink); }
.cpt-croix--prop { position: absolute; top: 6px; right: 6px; }

/* ---------- La fenêtre de connexion ---------- */
.cpt-fond {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 14px;
  background: rgba(4, 8, 17, .74);
  backdrop-filter: blur(3px);
  overflow-y: auto;
  animation: cpt-fondu .18s ease both;
}
:root[data-theme="light"] .cpt-fond { background: rgba(16, 33, 58, .5); }
@keyframes cpt-fondu { from { opacity: 0; } }

.cpt-modale {
  width: min(430px, 100%);
  max-height: calc(100vh - 28px);
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--panel-2);
  border: 2px solid color-mix(in srgb, var(--gold) 45%, var(--line));
  border-radius: 20px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
  color: var(--ink);
  animation: cpt-monte .22s cubic-bezier(.2, 0, 0, 1) both;
}
@keyframes cpt-monte { from { opacity: 0; transform: translateY(14px); } }
.cpt-modale-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.cpt-titre { font-size: 1.12rem; font-weight: 800; margin: 0; }

/* Onglets */
.cpt-onglets {
  display: flex; gap: 6px;
  padding: 4px;
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  border: 1px solid var(--line);
  border-radius: 13px;
  margin-bottom: 14px;
}
.cpt-onglet {
  flex: 1;
  min-height: 40px;
  padding: 8px 10px;
  border: none; border-radius: 10px;
  background: none;
  font: inherit; font-weight: 700; font-size: .9rem;
  color: var(--ink-dim);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.cpt-onglet--actif { background: var(--brand); color: #fff; }
:root[data-theme="light"] .cpt-onglet--actif { color: #fff; }

/* Formulaire */
.cpt-form { display: flex; flex-direction: column; gap: 11px; }
.cpt-champ { display: block; }
/* Un display: propre à nous écraserait l'attribut hidden du navigateur :
   on le rétablit, sinon le prénom resterait visible en mode connexion. */
.cpt-champ[hidden], .cpt-google-officiel[hidden], .cpt-tiers[hidden], .cpt-message[hidden] { display: none; }
.cpt-label {
  display: block;
  font-size: .82rem; font-weight: 700;
  color: var(--ink-dim);
  margin-bottom: 5px;
}
.cpt-facultatif { font-weight: 600; opacity: .8; }
.cpt-form input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}
.cpt-form input::placeholder { color: var(--ink-dim); opacity: .7; }
.cpt-form input:focus { outline: none; border-color: var(--gold); }
.cpt-form input:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.cpt-message {
  margin: 0;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--banner-err);
  border: 1px solid color-mix(in srgb, var(--err) 55%, transparent);
  color: var(--ink);
  font-size: .88rem;
  line-height: 1.45;
}
.cpt-message--ok {
  background: var(--banner-ok);
  border-color: color-mix(in srgb, var(--ok) 55%, transparent);
}
.cpt-form .cpt-btn { margin-top: 3px; }

/* Google et Facebook (présents seulement si le serveur les a configurés) */
.cpt-tiers { margin-top: 14px; }
.cpt-ou {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-dim);
  font-size: .8rem; font-weight: 700;
  margin-bottom: 11px;
}
.cpt-ou::before, .cpt-ou::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
.cpt-tiers-boutons { display: flex; flex-direction: column; gap: 9px; }
.cpt-google-officiel { display: flex; justify-content: center; margin-top: 11px; }

/* Vie privée */
.cpt-vieprivee {
  margin: 14px 0 0;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--ink-dim);
  text-align: center;
}
.cpt-vieprivee a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Le bloc greffé dans la page profil ---------- */
.cpt-profil {
  margin: 16px 0 0;
  padding: 14px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 72%, transparent);
  border: 1px solid var(--line);
}
.cpt-profil-etat {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 5px;
  font-weight: 800; font-size: .95rem;
  color: var(--ok);
}
.cpt-profil-etat--libre { color: var(--gold); }
.cpt-profil-etat svg { width: 18px; height: 18px; flex: none; }
.cpt-profil-note {
  margin: 0 0 11px;
  font-size: .84rem; line-height: 1.5;
  color: var(--ink-dim);
  overflow-wrap: anywhere;
}

/* ---------- Le petit mot de confirmation ---------- */
.cpt-toast {
  position: fixed; z-index: 520;
  left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  max-width: calc(100vw - 32px);
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700; font-size: .9rem;
  text-align: center;
  box-shadow: 0 10px 26px var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.cpt-toast--vu { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Écrans étroits ---------- */
@media (max-height: 560px) {
  .cpt-prop-titre { font-size: 1.08rem; }
  .cpt-prop-texte { font-size: .88rem; }
  .cpt-modale { padding-top: 10px; }
}

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion=vivant]):not([data-motion=doux]) .cpt-proposition{ transition: none; transform: translate(-50%, 0); }
  html:not([data-motion=vivant]):not([data-motion=doux]) .cpt-fond, html:not([data-motion=vivant]):not([data-motion=doux]) .cpt-modale{ animation: none; }
  html:not([data-motion=vivant]):not([data-motion=doux]) .cpt-btn, html:not([data-motion=vivant]):not([data-motion=doux]) .cpt-toast, html:not([data-motion=vivant]):not([data-motion=doux]) .cpt-onglet{ transition: none; }
}
