/* Loading dùng CHUNG cho mọi trang bói — bản tách từ "quiz section" (.quiz-loading)
   để mọi luận giải có cùng hiệu ứng skeleton shimmer dễ thương. Prefix `fl-` để không
   đụng class của quiz. Nạp toàn cục ở views/layout.ejs. */
.fl-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 26px 4px 24px;
    color: #8a7772;
    width: 100%;
}

.fl-loading-spark {
    display: inline-block;
    margin-right: 2px;
    animation: flSparkPulse 1.8s ease-in-out infinite;
}

.fl-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 460px;
    padding: 2px 6px;
}

.fl-sk-line {
    height: 13px;
    border-radius: 7px;
    background-color: #f7ddd2;
    background-image: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.85) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    background-size: 160px 100%;
    background-repeat: no-repeat;
    background-position: -160px 0;
    transform-origin: left center;
    box-shadow: inset 0 0 0 1px rgba(243, 164, 138, 0.12);
    animation: flSkShimmer 1.5s ease-in-out infinite, flSkReveal 0.45s ease both;
}
.fl-sk-line:nth-child(1) { width: 94%; animation-delay: 0s, 0s; }
.fl-sk-line:nth-child(2) { width: 80%; animation-delay: 0.18s, 0.1s; }
.fl-sk-line:nth-child(3) { width: 88%; animation-delay: 0.36s, 0.2s; }
.fl-sk-line:nth-child(4) { width: 66%; animation-delay: 0.54s, 0.3s; }
.fl-sk-line:nth-child(5) { width: 46%; animation-delay: 0.72s, 0.4s; }

.fl-loading-text {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 800;
    background: linear-gradient(90deg, #d67d63, #f3a48a, #ffd9c8, #f3a48a, #d67d63);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: flShimmer 2.6s linear infinite;
    text-align: center;
}

.fl-dots i {
    font-style: normal;
    opacity: 0.2;
    animation: flDot 1.4s infinite;
}
.fl-dots i:nth-child(2) { animation-delay: 0.2s; }
.fl-dots i:nth-child(3) { animation-delay: 0.4s; }

.fl-loading-sub {
    margin: 0;
    font-size: 0.82rem;
    color: #b89a92;
    letter-spacing: 0.02em;
    animation: flSubFade 2.6s ease-in-out infinite;
    text-align: center;
}

@keyframes flSkShimmer {
    0% { background-position: -160px 0; }
    100% { background-position: calc(100% + 160px) 0; }
}
@keyframes flSkReveal {
    from { opacity: 0; transform: scaleX(0.55); }
    to   { opacity: 1; transform: scaleX(1); }
}
@keyframes flSparkPulse {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.8; }
    50% { transform: scale(1.28) rotate(14deg); opacity: 1; }
}
@keyframes flShimmer {
    to { background-position: 200% center; }
}
@keyframes flDot {
    0%, 60%, 100% { opacity: 0.2; }
    30% { opacity: 1; }
}
@keyframes flSubFade {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .fl-loading-spark,
    .fl-sk-line,
    .fl-loading-text,
    .fl-dots i,
    .fl-loading-sub {
        animation: none !important;
    }
}
