/* Màn hình chờ QCD Wiki: gradient xanh thương hiệu, logo nổi nhẹ, hỗ trợ safe-area & dark theme */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #1c74da;
}

/* Gỡ nền xanh màn hình chờ ngay khi Flutter dựng xong khung hình đầu để tránh lộ mảng xanh khi co khung nhìn */
html.qcd-app-ready,
html.qcd-app-ready body {
  background: #f4f8fa;
}

@media (prefers-color-scheme: dark) {
  html.qcd-app-ready,
  html.qcd-app-ready body {
    background: #111c2d;
  }
}

#splash, #splash * { box-sizing: border-box; }

#splash {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  min-height: 100%;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.5dvh, 12px);
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(18dvh, 110px)
    max(16px, env(safe-area-inset-left));
  font-family: "Nunito", "Quicksand", Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #ffffff;
  background-color: #1c74da;
  background-image:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, .36) 0%, rgba(165, 243, 252, .16) 22%, rgba(56, 189, 248, 0) 48%),
    linear-gradient(180deg, #166bd6 0%, #1c74da 48%, #3b82f6 100%);
  background-position: center center;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity .4s ease-out;
}
#splash.splash-hide { opacity: 0; pointer-events: none; }

.splash-logo {
  width: clamp(72px, min(36vw, 22dvh), 160px);
  height: clamp(72px, min(36vw, 22dvh), 160px);
  object-fit: contain;
  filter:
    drop-shadow(0 0 24px rgba(255, 255, 255, .52))
    drop-shadow(0 10px 24px rgba(12, 74, 160, .35));
  animation: splash-float 3s ease-in-out infinite;
}

.splash-title {
  margin: 4px 0 0;
  font-size: clamp(26px, min(8vw, 5.2dvh), 40px);
  font-weight: 800;
  letter-spacing: .3px;
  line-height: 1.15;
  text-align: center;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(14, 78, 165, .36), 0 1px 3px rgba(14, 78, 165, .28);
}

.splash-tagline {
  margin: 0;
  max-width: 90vw;
  font-size: clamp(14px, min(4vw, 2.5dvh), 17px);
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  color: rgba(255, 255, 255, .94);
  text-shadow: 0 1px 8px rgba(14, 78, 165, .32);
}

.splash-dots { display: flex; gap: 8px; margin-top: clamp(4px, 1.2dvh, 10px); }
.splash-dots i {
  width: clamp(7px, 1.8vw, 9px);
  height: clamp(7px, 1.8vw, 9px);
  border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 1px 6px rgba(14, 78, 165, .3);
  animation: splash-dot 1.2s ease-in-out infinite;
}
.splash-dots i:nth-child(2) { animation-delay: .15s; }
.splash-dots i:nth-child(3) { animation-delay: .3s; }

#splash-status, #splash-slow, .splash-noscript {
  margin: 0;
  font-size: clamp(12px, 3.2vw, 13px);
  font-weight: 500;
  text-align: center;
  color: rgba(255, 255, 255, .9);
  text-shadow: 0 1px 6px rgba(14, 78, 165, .32);
}

.splash-foot {
  position: absolute;
  bottom: max(12px, env(safe-area-inset-bottom));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 1px 6px rgba(14, 78, 165, .4);
}

@media (max-height: 520px) {
  #splash {
    gap: 4px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-bottom: max(76px, 20dvh);
  }
  .splash-logo {
    width: clamp(56px, 16dvh, 84px);
    height: clamp(56px, 16dvh, 84px);
  }
  .splash-title { margin-top: 2px; font-size: 22px; }
  .splash-tagline { font-size: 13px; }
  .splash-dots { margin-top: 2px; }
  .splash-foot { bottom: max(6px, env(safe-area-inset-bottom)); font-size: 10px; }
}

@keyframes splash-float { 50% { transform: translateY(-8px); } }
@keyframes splash-dot { 0%, 80%, 100% { opacity: .35; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .splash-logo, .splash-dots i { animation: none; }
}
