/* Écran de chargement : fresque des clans, titre or, barre de cristal dans un cadre or du kit crystal.
   Le fond couvre la page dès le premier affichage (style posé sur l'élément) ; son contenu apparaît en fondu. */
.load-screen {
    position: fixed; inset: 0; z-index: 50; color-scheme: only dark;
    transition: opacity 0.45s ease, visibility 0s linear 0.45s;
}
.load-screen.done { opacity: 0; visibility: hidden; pointer-events: none; }
.load-inner {
    position: absolute; inset: 0; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
    background: radial-gradient(120% 70% at 50% 30%, #5a3f9e 0%, #2c1f5c 45%, #160f1c 100%);
    animation: load-in 0.3s both;
}
@keyframes load-in { from { opacity: 0; } to { opacity: 1; } }
/* Fresque : couvre tout l'écran ; seul un voile sombre en bas porte le titre, la barre et l'astuce */
.load-art {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%;
    animation: load-art-drift 14s ease-out both;
}
.load-inner::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; pointer-events: none;
    background: linear-gradient(transparent, rgb(22 15 28 / 0.55) 35%, rgb(22 15 28 / 0.88) 75%);
}
@keyframes load-art-drift { from { transform: scale(1.08); } to { transform: scale(1); } }
/* Sans fresque (pas encore livrée, ou introuvable) : des éclats de cristal montent doucement */
.load-inner::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(2px 2px at 20% 70%, #bfe3ff, transparent),
        radial-gradient(3px 3px at 72% 40%, #fff1b8, transparent),
        radial-gradient(2px 2px at 45% 25%, #9fd4ff, transparent),
        radial-gradient(2px 2px at 85% 75%, #bfe3ff, transparent),
        radial-gradient(3px 3px at 30% 45%, #fff1b8, transparent);
    background-size: 100% 100%;
    animation: load-motes 6s linear infinite;
    opacity: 0.8;
}
@keyframes load-motes { from { transform: translateY(8%); opacity: 0; } 30% { opacity: 0.9; } to { transform: translateY(-12%); opacity: 0; } }
.load-bottom {
    position: relative; z-index: 1; width: min(86vw, 520px);
    padding-bottom: calc(9vh + env(safe-area-inset-bottom, 0px));
    display: grid; justify-items: center; gap: 1.6vh;
}
.load-title {
    margin: 0; text-align: center;
    font: clamp(34px, 11vw, 64px)/1 "Lilita One", "Arial Rounded MT Bold", sans-serif; letter-spacing: 0.02em;
    color: #fff1b8;
    background: linear-gradient(180deg, #fffbe6 0%, #fff1b8 35%, #e8b84a 70%, #b9801e 100%);
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 0 #5a2a08) drop-shadow(0 0 14px rgb(255 210 120 / 0.55));
}
.load-title small { display: block; margin-top: 0.6vh; font-size: 0.34em; letter-spacing: 0.32em; text-transform: uppercase;
    -webkit-text-fill-color: #bfe3ff; filter: none; text-shadow: 0 0 10px rgb(120 190 255 / 0.9); }
/* Barre : cadre or à gemmes du kit (bar_frame 1000 × 99, de STORYGEN), posé par-dessus ; dessous, le rail sombre
   (y 22 à 75, x 36 à W − 38 dans l'image) qui reçoit le remplissage de cristal. Le cadre garde ses proportions. */
.load-bar {
    position: relative; width: 100%; aspect-ratio: 1000 / 99;
    filter: drop-shadow(0 4px 6px rgb(0 0 0 / 0.55)) drop-shadow(0 0 14px rgb(232 184 74 / 0.25));
}
.load-bar::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: url("loading/bar_frame.webp") center / 100% 100% no-repeat;
}
.load-rail {
    position: absolute; top: 22.2%; bottom: 24.2%; left: 3.6%; right: 3.8%;
    border-radius: 999px; overflow: hidden;
    background: linear-gradient(#2a1a4e, #140c2a);
    box-shadow: inset 0 2px 6px rgb(0 0 0 / 0.7);
}
.load-fill {
    position: relative; height: 100%; width: 0; border-radius: 999px; overflow: hidden;
    background: linear-gradient(180deg, #e9f6ff 0%, #9fd4ff 30%, #4f86f0 65%, #3a4fc8 100%);
    box-shadow: 0 0 12px rgb(120 190 255 / 0.9), inset 0 -3px 4px rgb(20 30 120 / 0.5);
    /* Avant le script : la barre avance d'elle-même jusqu'à un cinquième */
    animation: load-early 4s cubic-bezier(.2, .7, .3, 1) forwards;
}
.load-fill.driven { animation: none; }
@keyframes load-early { from { width: 0; } to { width: 20%; } }
.load-fill::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgb(255 255 255 / 0.75) 45%, transparent 60%);
    background-size: 220% 100%;
    animation: load-shine 1.6s linear infinite;
}
@keyframes load-shine { from { background-position: 120% 0; } to { background-position: -100% 0; } }
/* Gemme de tête : l'étincelle au bout du remplissage */
.load-fill::before {
    content: ""; position: absolute; right: -2px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%) rotate(45deg);
    background: radial-gradient(circle, #fff 0 30%, #bfe3ff 60%, transparent 70%); z-index: 1;
    filter: drop-shadow(0 0 6px #9fd4ff);
}
.load-percent {
    position: absolute; inset: 0; z-index: 1; display: grid; place-items: center;
    font: 900 clamp(12px, 3.4vw, 16px)/1 "Nunito", "Segoe UI", sans-serif;
    /* Couleur posée en dur (y compris le remplissage WebKit) et contour sombre : lisible sur le rail vide
       comme sur le cristal, même quand le navigateur assombrit ou recolore la page */
    color: #fff8e7; -webkit-text-fill-color: #fff8e7;
    -webkit-text-stroke: 3px #1b1840; paint-order: stroke fill;
    text-shadow: 0 0 6px rgb(255 248 231 / 0.35); font-variant-numeric: tabular-nums;
}
.load-tip {
    margin: 0; min-height: 2.6em; max-width: 92%; text-align: center;
    font: 700 clamp(13px, 3.6vw, 17px)/1.3 "Nunito", "Segoe UI", sans-serif; color: #e8dcff;
    text-shadow: 0 1px 2px #000; transition: opacity 0.35s;
}
.load-tip.fading { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
    .load-art, .load-inner::before, .load-fill::after { animation: none; }
}
