/* ===================================================
   KURO ARCANA — Écran de chargement (classes .ch-*, chargement.js) : sceau, particules, barre de progression,
   astuces, messages du compte et de la sauvegarde, éclat final, cinématique. Transform et opacity seulement.
   =================================================== */
.ch-ecran { gap: 22px; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); overflow: hidden; color: #f3e9ff; }
.ch-ecran > :not(.ch-fond) { position: relative; z-index: 1; }

/* Fond : sceau occulte (tracé trait par trait), halo, particules */
.ch-fond { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
/* Le sceau tourne : sa diagonale (× 1,42) doit rester dans l'écran */
.ch-sceau { position: absolute; left: 50%; top: 42%; width: min(66vw, 560px); aspect-ratio: 1; margin: calc(min(66vw, 560px) / -2) 0 0 calc(min(66vw, 560px) / -2); opacity: 0.55; }
.ch-trait { fill: none; stroke-width: 1.3; stroke-linecap: round; }
.ch-or { stroke: #c9a24a; }
.ch-violet { stroke: #9b4dff; }
.ch-rouge { stroke: #dc143c; }
.ch-halo { position: absolute; left: 50%; top: 42%; width: min(420px, 96vw); aspect-ratio: 1; translate: -50% -50%; border-radius: 50%; background: radial-gradient(circle, rgba(153, 50, 204, 0.28), rgba(220, 20, 60, 0.12) 45%, transparent 70%); }
.ch-particules { position: absolute; left: 50%; top: 55%; }
.ch-particules i { position: absolute; width: 6px; height: 6px; border-radius: 50%; opacity: 0; will-change: transform, opacity; }
.ch-p-violet { background: #b56cff; box-shadow: 0 0 10px #9932cc; }
.ch-p-rouge { background: #ff4d6d; box-shadow: 0 0 10px #dc143c; }

.ch-ecran .demarrage-credit { margin-top: 8px; font-size: 16px; }
.ch-logo { flex-direction: column; gap: 6px; text-align: center; }
.ch-sous-titre { margin: 0; font-size: 16px; letter-spacing: 0.08em; color: #d9c8ea; }

/* Barre de progression : remplissage (scaleX) et traînée lumineuse (translateX) */
.ch-progression { width: min(86vw, 460px); }
.ch-barre { position: relative; height: 10px; border-radius: 6px; overflow: hidden; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 215, 0, 0.35); }
.ch-rempli { position: absolute; inset: 0; transform: scaleX(0); transform-origin: left center; background: linear-gradient(90deg, #4b0082, #9932cc 45%, #dc143c 80%, #ffd700); }
.ch-trainee { position: absolute; top: -6px; bottom: -6px; left: -10%; width: 10%; background: radial-gradient(ellipse at center, rgba(255, 240, 180, 0.95), rgba(255, 215, 0, 0.35) 40%, transparent 70%); transform: translateX(0); }
.ch-ligne { display: flex; justify-content: space-between; gap: 12px; margin: 8px 0 0; font-size: 16px; }
.ch-ligne b { color: var(--or-dore, #ffd700); font-variant-numeric: tabular-nums; }

.ch-astuce { width: min(88vw, 520px); min-height: 3.2em; margin: 0; font-size: 16px; line-height: 1.45; text-align: center; color: #e8dcf4; }

/* Messages : sauvegarde restaurée, hors ligne, session expirée */
.ch-messages { width: min(92vw, 520px); display: flex; flex-direction: column; gap: 8px; }
.ch-messages:empty { display: none; }
.ch-message { padding: 10px 14px; border-radius: 14px; font-size: 16px; border: 1px solid rgba(255, 215, 0, 0.45); background: rgba(26, 8, 32, 0.92); }
.ch-message p { margin: 0; }
.ch-message-restauree { border-color: #3ddc6a; }
.ch-message-horsligne { border-color: #ff9d2e; }
.ch-message-expiree { border-color: #dc143c; }
.ch-message-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.ch-bouton {
  flex: 1; min-height: 44px; padding: 0 14px; border-radius: 12px; font: inherit; font-size: 16px; font-weight: 800; color: #fff; cursor: pointer;
  border: 1px solid rgba(255, 215, 0, 0.5); background: linear-gradient(180deg, #3a0f4a, #1a0820);
}
.ch-principal { border-color: #fff3a0; background: linear-gradient(180deg, #b8860b, #6b4a00); }
.ch-revoir { margin: 16px auto 0; display: block; flex: none; }

.ch-commencer { min-height: 56px; }
.ch-commencer:disabled { opacity: 0.55; cursor: progress; transform: none; }
/* Prêt : un halo qui respire autour du bouton (le bouton lui-même ne bouge pas) */
.ch-commencer { position: relative; }
.ch-commencer.ch-pret::before { content: ''; position: absolute; inset: -6px; border-radius: 14px; pointer-events: none; box-shadow: 0 0 24px rgba(255, 215, 0, 0.75), 0 0 48px rgba(220, 20, 60, 0.5); animation: ch-appel 1.6s ease-in-out infinite; }
@keyframes ch-appel { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* Éclat final vers l'accueil */
.ch-eclat { position: fixed; left: 50%; top: 50%; z-index: 2000; width: 60vmax; height: 60vmax; margin: -30vmax 0 0 -30vmax; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 250, 230, 1), rgba(255, 215, 0, 0.7) 30%, rgba(220, 20, 60, 0.25) 55%, transparent 70%); opacity: 0; }
.ch-eclat-css { animation: ch-eclat 0.7s ease-out forwards; }
@keyframes ch-eclat { 0% { opacity: 0; transform: scale(0.2); } 35% { opacity: 1; transform: scale(2.4); } 100% { opacity: 0; transform: scale(2.6); } }

/* Sans GSAP : mêmes effets en CSS */
.ch-css .ch-logo { animation: ch-apparait 0.9s ease-out both; }
.ch-css .ch-trait { animation: ch-apparait 0.4s ease-out both; }
.ch-css .ch-trait:nth-child(5n + 1) { animation-delay: 0.2s; } .ch-css .ch-trait:nth-child(5n + 2) { animation-delay: 0.45s; }
.ch-css .ch-trait:nth-child(5n + 3) { animation-delay: 0.7s; } .ch-css .ch-trait:nth-child(5n + 4) { animation-delay: 0.95s; } .ch-css .ch-trait:nth-child(5n) { animation-delay: 1.2s; }
.ch-css .ch-sceau { animation: ch-tourne 160s linear infinite; }
.ch-css .ch-particules i { animation: ch-monte calc(4s + var(--k) * 0.25s) ease-in-out infinite; animation-delay: calc(var(--k) * -0.4s); left: calc((var(--k) - 8) * 20px); }
@keyframes ch-apparait { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes ch-tourne { to { transform: rotate(360deg); } }
@keyframes ch-monte { 0% { opacity: 0; transform: translateY(200px); } 30% { opacity: 0.8; } 100% { opacity: 0; transform: translateY(-120px); } }

/* Cinématique */
.ch-intro { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; background: #000; cursor: pointer; }
.ch-intro-video { width: 100%; height: 100%; object-fit: contain; }
.ch-intro-passer { position: absolute; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); margin: 0; padding: 8px 14px; border-radius: 12px; font-size: 16px; color: #fff; background: rgba(0, 0, 0, 0.55); }

/* Mode test (écran passé) et mouvement réduit : rien ne bouge */
.ch-test .ch-fond { display: none; }
@media (prefers-reduced-motion: reduce) {
  .ch-particules, .ch-commencer.ch-pret::before { animation: none !important; }
  .ch-particules { display: none; }
  .ch-css .ch-sceau { animation: none; }
}
@media (max-width: 768px) {
  .ch-ecran .titre-demarrage { font-size: clamp(28px, 9vw, 44px); letter-spacing: 0.12em; }
  .ch-ecran .kanji-demarrage { font-size: 56px; }
  .ch-ecran { gap: 16px; }
}
.ch-intro-erreur .ch-intro-passer { left: 16px; right: 16px; text-align: center; }
