/* ── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body  { margin: 0; }
html  { overflow-x: hidden; overflow-y: scroll; }

/* ── Page ───────────────────────────────────────────────── */
#loading-bg {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--initial-loader-bg, #eef1f8);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Blobs ──────────────────────────────────────────────── */
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.15;
  animation: blob-drift 9s ease-in-out infinite alternate;
  pointer-events: none;
}
.blob-1 { width:480px; height:480px; background:#7B2D8B; top:-160px;  left:-140px; animation-delay:0s;  }
.blob-2 { width:380px; height:380px; background:#4CAF50; bottom:-100px; right:-100px; animation-delay:3s; }
.blob-3 { width:300px; height:300px; background:#2196F3; top:40%;   right:5%;  animation-delay:1.5s; }
.blob-4 { width:220px; height:220px; background:#FF9800; bottom:20%; left:5%;   animation-delay:5s;  }

@keyframes blob-drift {
  0%   { transform: scale(1)    translate(0,0);       }
  100% { transform: scale(1.18) translate(28px,-22px); }
}

/* ── Card ───────────────────────────────────────────────── */
.loader-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 28px;
  padding: 36px 40px 28px;
  box-shadow:
    0 12px 48px rgba(123,45,139,0.13),
    0 2px 10px rgba(0,0,0,0.05);
  width: min(440px, 92vw);
  animation: card-in 0.55s cubic-bezier(0.34,1.56,0.64,1) both;
  overflow: hidden;
}

@keyframes card-in {
  0%   { opacity:0; transform:translateY(32px) scale(0.93); }
  100% { opacity:1; transform:translateY(0)    scale(1);    }
}

/* ── Logo ring ──────────────────────────────────────────── */
.logo-ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-ring::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(#7B2D8B, #4CAF50, #2196F3, #7B2D8B);
  animation: spin-ring 3s linear infinite;
  opacity: 0.5;
  filter: blur(3px);
}

.logo-ring::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
}

.loading-logo {
  animation: logo-pop 0.65s cubic-bezier(0.34,1.56,0.64,1) 0.1s both;
  margin-bottom: 14px;
}

.loader-logo-img {
  position: relative;
  z-index: 1;
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(123,45,139,0.22));
}

@keyframes spin-ring {
  to { transform: rotate(360deg); }
}

@keyframes logo-pop {
  0%   { opacity:0; transform:scale(0.65); }
  100% { opacity:1; transform:scale(1);    }
}

/* ── Title ──────────────────────────────────────────────── */
.loading-title {
  margin: 0 0 3px;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: 0.2px;
  background: linear-gradient(135deg, #4CAF50 0%, #7B2D8B 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fade-up 0.6s ease 0.3s both;
}

.loading-subtitle {
  margin: 0 0 18px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #9e9e9e;
  animation: fade-up 0.6s ease 0.4s both;
}

/* ── Heartbeat ──────────────────────────────────────────── */
.heartbeat-wrap {
  width: 100%;
  height: 38px;
  margin-bottom: 18px;
  animation: fade-up 0.5s ease 0.5s both;
}

.heartbeat-svg { width: 100%; height: 100%; }

.heartbeat-line {
  fill: none;
  stroke: url(#hb-grad);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
  animation:
    draw-line 1.6s ease 0.6s forwards,
    pulse-glow 2.4s ease-in-out 2.4s infinite;
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}
@keyframes pulse-glow {
  0%,100% { opacity:1;   filter: drop-shadow(0 0 2px #7B2D8B44); }
  50%      { opacity:0.5; filter: drop-shadow(0 0 6px #4CAF5088); }
}

/* ── Marquee ────────────────────────────────────────────── */
.marquee-track {
  width: 100%;
  overflow: hidden;
  margin-bottom: 8px;
  mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 12%, black 88%, transparent 100%);
  animation: fade-up 0.6s ease 0.75s both;
}

.marquee-row {
  display: flex;
  width: max-content;
  gap: 8px;
}

.marquee-inner {
  display: flex;
  gap: 8px;
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}

.marquee-left  .marquee-inner { animation: scroll-left  28s linear infinite; }
.marquee-right .marquee-inner { animation: scroll-right 28s linear infinite; }

@keyframes scroll-left  { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes scroll-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }

/* ── Tag chips ──────────────────────────────────────────── */
.mtag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

.mtag.purple { background:rgba(123,45,139,0.10); color:#7B2D8B; }
.mtag.blue   { background:rgba(33,150,243,0.10);  color:#1565C0; }
.mtag.green  { background:rgba(76,175,80,0.10);   color:#2E7D32; }
.mtag.teal   { background:rgba(0,150,136,0.10);   color:#00695C; }
.mtag.orange { background:rgba(255,152,0,0.10);   color:#E65100; }
.mtag.red    { background:rgba(244,67,54,0.10);   color:#C62828; }
.mtag.indigo { background:rgba(63,81,181,0.10);   color:#283593; }
.mtag.cyan   { background:rgba(0,188,212,0.10);   color:#006064; }
.mtag.pink   { background:rgba(233,30,99,0.10);   color:#880E4F; }
.mtag.amber  { background:rgba(255,193,7,0.12);   color:#F57F17; }

/* ── Progress ───────────────────────────────────────────── */
.progress-track {
  width: 100%;
  height: 5px;
  background: rgba(0,0,0,0.07);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 18px;
  margin-bottom: 10px;
  animation: fade-up 0.6s ease 0.95s both;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #7B2D8B, #4CAF50, #2196F3, #7B2D8B);
  background-size: 300% 100%;
  animation:
    progress-fill 4s cubic-bezier(0.4,0,0.2,1) 1s forwards,
    shimmer 2s linear 1s infinite;
}

@keyframes progress-fill {
  0%  { width:0%;  }
  30% { width:45%; }
  60% { width:72%; }
  85% { width:88%; }
  100%{ width:96%; }
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Status text ────────────────────────────────────────── */
.loading-status {
  margin: 0;
  font-size: 0.72rem;
  color: #bbb;
  letter-spacing: 0.3px;
  transition: opacity 0.22s ease;
  animation: fade-up 0.6s ease 1.05s both;
}

/* ── Shared ─────────────────────────────────────────────── */
@keyframes fade-up {
  0%   { opacity:0; transform:translateY(10px); }
  100% { opacity:1; transform:translateY(0);    }
}
