/* Màn hình loading — dùng chung cho mọi trang.
   Logo được "đổ đầy" từ dưới lên bằng sóng nước, thanh tiến trình chạy dưới đáy,
   số % lớn ở góc; khi xong, cả màn kéo lên như tấm rèm cong. */
@property --wx { syntax: "<percentage>"; inherits: false; initial-value: 0%; }

.cs3-loader { --brand: #4da3ff; position: fixed; inset: 0; z-index: 2147483000; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(60vmax 60vmax at 50% 55%, rgba(77,163,255,.10), transparent 60%), #0a0a0e;
  visibility: visible !important; opacity: 1 !important;
  border-radius: 0 0 0 0 / 0 0 0 0;
  transition: transform 1s cubic-bezier(.76,0,.24,1) .2s, border-radius 1s cubic-bezier(.76,0,.24,1) .2s; }
/* quầng sáng mềm phía sau logo (chỉ dùng gradient, không dùng blur để tránh viền vuông) */
.cs3-loader::before { content: ""; position: absolute; width: 520px; height: 520px; left: 50%; top: 50%; margin: -260px 0 0 -260px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(77,163,255,.16), rgba(178,156,255,.07) 55%, transparent 100%);
  animation: cms-pulse 3.2s ease-in-out infinite; pointer-events: none; }
/* thanh tiến trình dưới đáy */
.cs3-loader::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--p, 0%); transition: none;
  background: linear-gradient(90deg, #b29cff, var(--brand)); box-shadow: 0 0 12px rgba(77,163,255,.7); }

.cs3-loader-logo { position: relative; width: 132px; aspect-ratio: 2262 / 2083; animation: cms-float 2.4s ease-in-out infinite;
  transition: transform .7s cubic-bezier(.7,0,.3,1), opacity .5s ease; }
.cs3-loader-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.cs3-loader-base { opacity: .12; filter: grayscale(1) brightness(1.6); }
/* đổ đầy bằng sóng: mặt nạ SVG gồm nửa trên trong suốt, đường sóng ở giữa, nửa dưới đặc */
.cs3-loader-fill { clip-path: none !important;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 100 Q25 90 50 100 T100 100 T150 100 T200 100 V200 H0Z' fill='%23000'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200' preserveAspectRatio='none'%3E%3Cpath d='M0 100 Q25 90 50 100 T100 100 T150 100 T200 100 V200 H0Z' fill='%23000'/%3E%3C/svg%3E");
  -webkit-mask-size: 200% 220%; mask-size: 200% 220%; -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x;
  -webkit-mask-position: var(--wx) var(--p, 0%); mask-position: var(--wx) var(--p, 0%);
  animation: cms-wave 1.6s linear infinite; }

.cs3-loader-pct { position: absolute; right: clamp(20px, 4vw, 56px); bottom: calc(clamp(18px, 3.5vw, 44px) + env(safe-area-inset-bottom, 0px)); left: auto; transform: none;
  font: 800 clamp(44px, 7vw, 96px)/.9 "Gilroy", system-ui, sans-serif; letter-spacing: -.03em; color: rgba(255,255,255,.9); font-variant-numeric: tabular-nums;
  transition: opacity .4s ease, transform .6s cubic-bezier(.7,0,.3,1); }
.cs3-loader-pct::before { content: "Loading"; position: absolute; left: 2px; top: -22px; font: 500 12px/1 "Outfit", system-ui, sans-serif; letter-spacing: .24em; text-transform: uppercase; color: rgba(255,255,255,.38); }

/* Kết thúc: logo nảy nhẹ rồi mờ, cả màn kéo lên với mép dưới cong */
.cs3-loader.out { visibility: visible !important; transform: translateY(-105%); border-radius: 0 0 50% 50% / 0 0 18vh 18vh; pointer-events: none; }
.cs3-loader.out .cs3-loader-logo { animation: none; transform: translateY(-30px) scale(.92); opacity: 0; }
.cs3-loader.out .cs3-loader-pct { opacity: 0; transform: translateY(-24px); }
.cs3-loader.out::after { opacity: 0; transition: opacity .3s; }

@keyframes cms-wave { to { --wx: 100%; } }
@keyframes cms-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes cms-pulse { 0%, 100% { transform: scale(.9); opacity: .75; } 50% { transform: scale(1.06); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cs3-loader::before { animation: none; } }
/* Chỉ hiển thị logo */
.cs3-loader-pct { display: none !important; }
