/* POLARISTAR — fenêtre de bienvenue (19/11/2026)
   Affichée à l'arrivée sur l'accueil (plateau SYNAXIS) pour un visiteur sans compte connecté,
   ou un compte connecté qui n'a pas encore passé l'Initiation. Voir polaristar-bienvenue.js.
   21/11 : refonte « portail astral » (fond cosmique + astrolabe, fenêtre en or ancien, médaillon de
   l'étoile polaire, bouton d'or). Seulement transform / opacity animés ; mouvements coupés si
   prefers-reduced-motion, allégés au téléphone. Préfixe : psb- */

.psb-veil {
  --psb-gold: #d9b45a;
  --psb-gold-hi: #f6dc8e;
  --psb-ivory: #f7efdc;
  --psb-ink: #1d0b3a;
  --psb-top: 54px;                 /* place du médaillon qui dépasse au-dessus de la fenêtre */
  position: fixed; inset: 0; z-index: 10050;
  display: flex; align-items: center; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 42%, rgba(58, 26, 120, .55), transparent 70%),
    radial-gradient(ellipse at 50% 100%, rgba(30, 12, 70, .9), transparent 60%),
    #07031a;
  opacity: 0; transition: opacity .55s ease;
}
.psb-veil.is-open { opacity: 1; }
.psb-veil.is-closing { opacity: 0; transition-duration: .3s; }

/* ── Niveau 1 : l'univers ─────────────────────────────────────────────── */
.psb-cosmos { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.psb-nebula { position: absolute; inset: -20%; will-change: transform; }
.psb-nebula-a {
  background:
    radial-gradient(ellipse 38% 30% at 22% 30%, rgba(132, 70, 230, .32), transparent 70%),
    radial-gradient(ellipse 30% 26% at 80% 66%, rgba(170, 80, 220, .24), transparent 70%),
    radial-gradient(ellipse 26% 20% at 70% 18%, rgba(80, 60, 200, .22), transparent 70%);
  animation: psb-drift-a 70s ease-in-out infinite alternate;
}
.psb-nebula-b {
  background:
    radial-gradient(ellipse 34% 22% at 30% 78%, rgba(120, 50, 190, .26), transparent 70%),
    radial-gradient(ellipse 22% 18% at 88% 36%, rgba(230, 170, 90, .08), transparent 70%);
  animation: psb-drift-b 90s ease-in-out infinite alternate;
}
@keyframes psb-drift-a { to { transform: translate3d(3%, -2%, 0) scale(1.04); } }
@keyframes psb-drift-b { to { transform: translate3d(-3%, 2%, 0) scale(1.06); } }

.psb-stars { position: absolute; inset: 0; }
.psb-stars-a {
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 38% 72%, #fff 50%, transparent 52%),
    radial-gradient(1.4px 1.4px at 64% 34%, #ffeec2 50%, transparent 52%),
    radial-gradient(1px 1px at 86% 82%, #fff 50%, transparent 52%),
    radial-gradient(1px 1px at 52% 8%, #d9c8ff 50%, transparent 52%);
  background-size: 230px 250px;
  opacity: .75;
  animation: psb-twinkle 6s ease-in-out infinite alternate;
}
.psb-stars-b {
  background-image:
    radial-gradient(1.6px 1.6px at 20% 40%, #fff6d6 50%, transparent 52%),
    radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent 52%),
    radial-gradient(2px 2px at 46% 88%, #f3dcff 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 92% 56%, #fff 50%, transparent 52%);
  background-size: 370px 330px;
  opacity: .5;
  animation: psb-twinkle 9s ease-in-out -3s infinite alternate;
}
@keyframes psb-twinkle { 0% { opacity: .35; } 100% { opacity: .9; } }

.psb-astro {
  position: absolute; left: 50%; top: 46%;
  width: min(1120px, 150vmin); height: auto; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: 1;
  -webkit-mask-image: radial-gradient(circle, #000 55%, transparent 72%);
          mask-image: radial-gradient(circle, #000 55%, transparent 72%);
}
.psb-astro-a, .psb-astro-b { transform-box: view-box; transform-origin: 50% 50%; }
.psb-astro-a { animation: psb-spin 240s linear infinite; }
.psb-astro-b { animation: psb-spin 320s linear infinite reverse; }
@keyframes psb-spin { to { transform: rotate(360deg); } }

/* disque de lumière sous le portail (le « lac » de la référence) */
.psb-floor {
  position: absolute; left: 50%; bottom: -9vmin;
  width: min(1200px, 160vmin); aspect-ratio: 1;
  transform: translateX(-50%) scaleY(.2); transform-origin: 50% 100%;
}
.psb-floor span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(240, 200, 110, .35);
  box-shadow: 0 0 40px rgba(240, 190, 90, .25), inset 0 0 60px rgba(150, 90, 240, .25);
}
.psb-floor span:nth-child(2) { inset: 12%; border-color: rgba(240, 200, 110, .22); border-style: dashed; }
.psb-floor span:nth-child(3) { inset: 28%; border-color: rgba(170, 120, 255, .3); background: radial-gradient(circle, rgba(255, 220, 140, .22), transparent 65%); }

/* ── Niveau 2 : le portail ───────────────────────────────────────────── */
.psb-stage {
  position: relative; width: 100%; max-width: 580px;
  padding-top: var(--psb-top);
  pointer-events: none;            /* un clic hors de la fenêtre atteint le voile (= fermer) */
  animation: psb-float 9s ease-in-out infinite;
}
@keyframes psb-float { 50% { transform: translateY(-6px); } }

.psb-box {
  pointer-events: auto;
  position: relative; box-sizing: border-box;
  color: var(--psb-ivory);
  font-family: var(--ps-font-serif, 'Crimson Text', Georgia, serif);
  text-align: center;
  background:
    radial-gradient(ellipse 80% 40% at 50% 0%, rgba(240, 200, 110, .12), transparent 70%),
    radial-gradient(ellipse 90% 50% at 50% 100%, rgba(130, 70, 230, .18), transparent 70%),
    linear-gradient(180deg, rgba(26, 12, 60, .9) 0%, rgba(12, 5, 32, .94) 100%);
  border: 1px solid rgba(232, 196, 110, .75);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .5),
    inset 0 0 0 1px rgba(255, 235, 170, .06),
    inset 0 0 50px rgba(110, 60, 200, .18),
    0 40px 90px rgba(0, 0, 0, .7),
    0 0 90px rgba(140, 80, 240, .28);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transform: translateY(18px) scale(.97);
  transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}
.psb-veil.is-open .psb-box { transform: none; }

/* double encadrement intérieur */
.psb-frame {
  position: absolute; inset: 9px; border-radius: 13px; pointer-events: none;
  border: 1px solid rgba(232, 196, 110, .32);
}
.psb-frame::after {
  content: ''; position: absolute; inset: 4px; border-radius: 10px;
  border: 1px solid rgba(232, 196, 110, .12);
}

/* arabesques d'angle */
.psb-c { position: absolute; width: 74px; height: 74px; pointer-events: none; font-style: normal; }
.psb-c svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 0 4px rgba(240, 200, 110, .35)); }
.psb-c-tl { top: -5px; left: -5px; }
.psb-c-tr { top: -5px; right: -5px; transform: scaleX(-1); }
.psb-c-bl { bottom: -5px; left: -5px; transform: scaleY(-1); }
.psb-c-br { bottom: -5px; right: -5px; transform: scale(-1, -1); }

/* cristal au pied de la fenêtre */
.psb-gem {
  position: absolute; left: 50%; bottom: -13px; width: 20px; height: 20px;
  transform: translateX(-50%) rotate(45deg); pointer-events: none;
  background: linear-gradient(135deg, #f1e4ff 0%, #a578f0 45%, #4b1f9e 100%);
  border: 1px solid var(--psb-gold-hi);
  box-shadow: 0 0 18px rgba(170, 120, 255, .7), 0 0 4px rgba(255, 230, 160, .8);
}

/* ── En-tête céleste ─────────────────────────────────────────────────── */
.psb-emblem {
  position: absolute; left: 50%; top: calc(var(--psb-top) * -1 - 4px);
  width: 112px; height: 112px; margin-left: -56px; pointer-events: none;
}
.psb-emblem::before {               /* halo d'or diffus */
  content: ''; position: absolute; inset: -40%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 120, .38) 0%, rgba(200, 140, 255, .12) 40%, transparent 68%);
  animation: psb-breathe 5s ease-in-out infinite;
}
.psb-crest { position: absolute; left: 50%; top: 50%; width: 320px; height: 80px; margin: -22px 0 0 -160px; filter: drop-shadow(0 0 5px rgba(240, 200, 110, .45)); }
.psb-emblem-svg { position: relative; display: block; width: 100%; height: 100%; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .6)); }
.psb-emblem-ring { transform-box: view-box; transform-origin: 50% 50%; animation: psb-spin 80s linear infinite; }
.psb-emblem-star {
  transform-box: view-box; transform-origin: 50% 50%;
  filter: drop-shadow(0 0 6px rgba(255, 225, 140, .9));
  animation: psb-star 5s ease-in-out infinite;
}
@keyframes psb-breathe { 0%, 100% { opacity: .65; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes psb-star { 0%, 100% { transform: scale(.96); opacity: .92; } 50% { transform: scale(1.04); opacity: 1; } }

.psb-veil .psb-x {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: 44px; height: 44px; padding: 0; margin: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer;
  background: transparent; color: var(--psb-ivory);
  transition: background .25s ease, color .25s ease, transform .25s ease;
}
.psb-veil .psb-x svg { width: 22px; height: 22px; }
.psb-veil .psb-x:hover { background: rgba(255, 255, 255, .07); color: var(--psb-gold-hi); transform: rotate(90deg); }
.psb-veil .psb-x:focus-visible { outline: 2px solid var(--psb-gold-hi); outline-offset: 2px; color: var(--psb-gold-hi); }

/* ── Niveau 3 : le contenu ───────────────────────────────────────────── */
.psb-inner {
  position: relative; box-sizing: border-box;
  max-height: calc(100svh - 32px - var(--psb-top));
  overflow-y: auto; overscroll-behavior: contain;
  padding: 70px 52px 38px;
  scrollbar-width: thin; scrollbar-color: rgba(217, 180, 90, .4) transparent;
}

.psb-kicker {
  margin: 0 0 10px; font-family: var(--ps-font-display, 'Cinzel', serif); font-weight: 500;
  font-size: 13px; letter-spacing: .34em; text-transform: uppercase; color: #ecd08a;
}
.psb-title {
  margin: 0; font-family: var(--ps-font-display, 'Cinzel', serif); font-weight: 600;
  line-height: 1.08; letter-spacing: .05em; text-transform: uppercase;
  color: var(--psb-gold-hi);
  filter: drop-shadow(0 0 14px rgba(240, 200, 110, .28));
}
.psb-title span {
  display: block;
  background: linear-gradient(180deg, #fffcf2 0%, #fbeec6 40%, #e9c574 78%, #c4953c 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.psb-t1 { font-size: clamp(26px, 6.4vw, 40px); }
.psb-t2 { font-size: clamp(30px, 8vw, 50px); }

.psb-rule { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px auto 18px; max-width: 280px; }
.psb-rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, rgba(232, 196, 110, .8)); }
.psb-rule span:last-child { transform: scaleX(-1); }
.psb-rule svg { width: 16px; height: 16px; filter: drop-shadow(0 0 5px rgba(255, 220, 130, .8)); }

.psb-text {
  margin: 0 auto 26px; max-width: 36ch;
  font-size: 19px; line-height: 1.5; color: #ece3f7;
}

/* ── Boutons ─────────────────────────────────────────────────────────── */
.psb-actions { display: flex; flex-direction: column; gap: 16px; padding: 0 10px; }

.psb-veil .psb-btn {
  position: relative; box-sizing: border-box;
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 14px;
  min-height: 76px; padding: 10px 34px 10px 18px;
  border-radius: 999px; text-decoration: none; cursor: pointer;
  text-align: center;
  transition: transform .25s ease, box-shadow .25s ease, background-color .25s ease, border-color .25s ease;
}
.psb-ico { width: 46px; height: 46px; display: block; }
.psb-lbl { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.psb-big {
  font-family: var(--ps-font-display, 'Cinzel', serif); font-weight: 700;
  font-size: 18px; letter-spacing: .06em; line-height: 1.2; text-transform: uppercase;
}
.psb-nw { white-space: nowrap; }
.psb-btn small { font-family: var(--ps-font-serif, 'Crimson Text', serif); font-size: 16px; font-weight: 400; letter-spacing: .01em; line-height: 1.2; }

/* bouton principal : l'or */
.psb-veil .psb-main {
  color: var(--psb-ink);
  background: linear-gradient(180deg, #fff3c2 0%, #f6d576 34%, #e0b04a 68%, #b98328 100%);
  border: 1px solid #fff0c0;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .8),
    inset 0 -3px 8px rgba(130, 80, 10, .35),
    0 0 0 1px rgba(140, 95, 20, .7),
    0 0 0 4px rgba(240, 200, 110, .12),
    0 12px 30px rgba(220, 170, 60, .3),
    0 0 46px rgba(245, 205, 110, .22);
}
.psb-main .psb-ico { color: #7a4a0e; filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .5)); }
.psb-main small { color: #3a1d55; }
.psb-main::before {                  /* lumière traversante */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(105deg, transparent 38%, rgba(255, 255, 255, .65) 50%, transparent 62%) no-repeat;
  background-size: 250% 100%; background-position: 160% 0;
  opacity: 0; transition: opacity .25s ease;
}
.psb-main .psb-lbl::before, .psb-main .psb-lbl::after {   /* pointes en losange de part et d'autre */
  content: ''; position: absolute; top: 50%; width: 11px; height: 11px; margin-top: -6px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fff3c2, #c9982e);
  box-shadow: 0 0 10px rgba(255, 215, 120, .8);
}
.psb-main .psb-lbl::before { left: -9px; }
.psb-main .psb-lbl::after { right: -9px; }
.psb-veil .psb-main:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .85),
    inset 0 -3px 8px rgba(130, 80, 10, .3),
    0 0 0 1px rgba(160, 110, 25, .75),
    0 0 0 5px rgba(240, 200, 110, .18),
    0 16px 36px rgba(230, 180, 70, .4),
    0 0 64px rgba(250, 215, 120, .38);
}
.psb-main:hover::before { opacity: 1; animation: psb-sheen 1.1s ease forwards; }
@keyframes psb-sheen { from { background-position: 160% 0; } to { background-position: -60% 0; } }

/* bouton secondaire : la nuit */
.psb-veil .psb-second {
  min-height: 70px;
  color: var(--psb-ivory);
  background: linear-gradient(180deg, rgba(52, 24, 104, .78), rgba(22, 9, 52, .9));
  border: 1px solid rgba(232, 196, 110, .7);
  box-shadow: inset 0 0 0 3px rgba(10, 4, 26, .6), inset 0 0 0 4px rgba(232, 196, 110, .16), 0 8px 24px rgba(0, 0, 0, .4);
}
.psb-second .psb-ico { width: 40px; height: 40px; margin-left: 4px; color: var(--psb-gold-hi); }
.psb-second .psb-big { color: #f3dd9c; letter-spacing: .1em; }
.psb-second small { color: #e2d6f2; }
.psb-veil .psb-second:hover {
  transform: translateY(-2px);
  border-color: rgba(246, 220, 142, .95);
  box-shadow: inset 0 0 0 3px rgba(10, 4, 26, .6), inset 0 0 0 4px rgba(232, 196, 110, .24), 0 10px 28px rgba(0, 0, 0, .45), 0 0 34px rgba(150, 90, 255, .45);
}

.psb-veil .psb-btn:active { transform: translateY(0) scale(.985); }
.psb-veil .psb-btn:focus-visible { outline: 2px solid #fff3c2; outline-offset: 4px; }

/* exploration libre */
.psb-veil .psb-later {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 20px auto 0; padding: 10px 14px; min-height: 44px;
  border: 0; border-radius: 10px; background: none; cursor: pointer;
  font-family: var(--ps-font-serif, 'Crimson Text', serif); font-size: 18px;
  color: #d9c8fb;
  transition: color .25s ease, background-color .25s ease;
}
.psb-later span { text-decoration: underline; text-decoration-color: rgba(217, 200, 251, .55); text-underline-offset: 4px; }
.psb-ico-s { width: 24px; height: 24px; color: var(--psb-gold-hi); transition: transform .6s ease; }
.psb-veil .psb-later:hover { color: #fff; }
.psb-later:hover .psb-ico-s { transform: rotate(45deg); }
.psb-veil .psb-later:focus-visible { outline: 2px solid var(--psb-gold-hi); outline-offset: 2px; color: #fff; }

html.psb-lock, html.psb-lock body { overflow: hidden; }

/* ── Tablette ────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .psb-astro { width: 175vmin; opacity: .6; }
  .psb-astro-b { display: none; }
}

/* ── Téléphone ───────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .psb-veil { --psb-top: 42px; padding-left: 12px; padding-right: 12px; }
  .psb-nebula, .psb-stage { animation: none; }
  .psb-stars-b { display: none; }
  .psb-box { -webkit-backdrop-filter: none; backdrop-filter: none; background-color: rgba(12, 5, 32, .96); }
  .psb-emblem { width: 88px; height: 88px; margin-left: -44px; }
  .psb-c { width: 42px; height: 42px; }
  .psb-inner { padding: 56px 18px 26px; }
  .psb-kicker { font-size: 12px; letter-spacing: .28em; }
  .psb-text { font-size: 17px; margin-bottom: 22px; }
  .psb-rule { margin: 12px auto 14px; }
  .psb-actions { padding: 0 6px; gap: 14px; }
  .psb-veil .psb-btn { min-height: 68px; padding: 8px 22px 8px 12px; gap: 10px; }
  .psb-veil .psb-second { min-height: 62px; }
  .psb-ico { width: 38px; height: 38px; }
  .psb-second .psb-ico { width: 34px; height: 34px; }
  .psb-big { font-size: 15px; letter-spacing: .04em; }
  .psb-btn small { font-size: 15px; }
  .psb-veil .psb-x { top: 8px; right: 8px; }
}
@media (max-width: 360px) {
  .psb-inner { padding-left: 12px; padding-right: 12px; }
  .psb-big { font-size: 14px; }
  .psb-veil .psb-btn { padding-right: 16px; }
  .psb-ico { width: 32px; height: 32px; }
}

/* ── Écrans bas (paysage téléphone, petites fenêtres) ────────────────── */
@media (max-height: 700px) {
  .psb-veil { --psb-top: 36px; }
  .psb-emblem { width: 76px; height: 76px; margin-left: -38px; }
  .psb-inner { padding-top: 48px; padding-bottom: 22px; }
  .psb-t1 { font-size: clamp(22px, 5vw, 32px); }
  .psb-t2 { font-size: clamp(26px, 6.4vw, 40px); }
  .psb-text { margin-bottom: 18px; }
  .psb-floor { display: none; }
}
@media (max-height: 480px) {
  .psb-veil { --psb-top: 28px; align-items: flex-start; }
  .psb-emblem { width: 60px; height: 60px; margin-left: -30px; }
  .psb-crest, .psb-gem { display: none; }
  .psb-inner { padding: 34px 28px 14px; }
  .psb-kicker { margin-bottom: 4px; font-size: 11px; }
  .psb-t1 { font-size: 20px; }
  .psb-t2 { font-size: 26px; }
  .psb-title span { display: inline; }
  .psb-rule { display: none; }
  .psb-text { font-size: 16px; line-height: 1.35; margin: 8px auto 12px; max-width: 52ch; }
  .psb-actions { flex-direction: row; gap: 12px; }
  .psb-actions .psb-btn { flex: 1 1 0; }
  .psb-veil .psb-btn, .psb-veil .psb-second { min-height: 58px; padding: 6px 18px 6px 10px; gap: 8px; }
  .psb-ico, .psb-second .psb-ico { width: 30px; height: 30px; }
  .psb-big { font-size: 13px; }
  .psb-btn small { font-size: 14px; }
  .psb-veil .psb-later { margin-top: 6px; }
}
@media (max-height: 480px) and (max-width: 520px) {
  .psb-actions { flex-direction: column; }
}

/* ── Mouvement réduit ────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .psb-veil, .psb-box, .psb-veil .psb-btn, .psb-ico-s, .psb-veil .psb-x { transition: none; }
  .psb-box { transform: none; }
  .psb-nebula, .psb-stars, .psb-stage, .psb-astro-a, .psb-astro-b,
  .psb-emblem::before, .psb-emblem-ring, .psb-emblem-star, .psb-main:hover::before { animation: none; }
  .psb-veil .psb-main:hover, .psb-veil .psb-second:hover { transform: none; }
  .psb-main:hover::before { opacity: 0; }
}
