/* Màn hình chờ: nền phong cảnh, thẻ kính mờ giữa màn, logo nổi, tiêu đề, 3 chấm tải (theo màn hình chờ QMM) */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2d5a3e;
  -webkit-font-smoothing: antialiased;
}

#splash, #splash * { box-sizing: border-box; }

#splash {
  position: fixed;
  inset: 0;
  z-index: 999999;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: #0f172a;
  background: #2d5a3e;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: opacity .4s ease-out;
}
#splash.splash-hide { opacity: 0; pointer-events: none; }

#splash::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.22)), #2d5a3e url('landscape.webp') center 55% / cover no-repeat;
}
/* Màn dọc (điện thoại): canh giữa ảnh để thấy trọn thung lũng và nhóm bác sĩ */
@media (max-aspect-ratio: 1/1) {
  #splash::before { background-position: 50% 55%; }
}

.splash-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(380px, calc(100vw - 32px));
  padding: 26px 34px 24px;
  border-radius: 28px;
  transform: translateY(49px);
  isolation: isolate;
  text-align: center;
}
.splash-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 18px 50px rgba(15, 60, 80, 0.28);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  backdrop-filter: blur(14px) saturate(1.25);
}

.splash-logo {
  width: 168px;
  height: 168px;
  max-width: 42vw;
  max-height: 42vw;
  object-fit: contain;
  filter: drop-shadow(0 10px 22px rgba(8, 145, 178, 0.35));
  animation: splash-float 2.4s ease-in-out infinite;
}

.splash-title {
  margin: 6px 0 0;
  font-size: 26px;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: #38d1c9;
}
.splash-title span {
  color: #f59e0b;
}
.splash-tagline {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
}

.splash-dots { display: flex; gap: 8px; margin-top: 18px; }
.splash-dots i {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #14b8c4;
  box-shadow: 0 0 10px rgba(20, 184, 196, 0.6);
  animation: splash-dot 1.2s ease-in-out infinite;
}
.splash-dots i:nth-child(2) { animation-delay: 0.15s; }
.splash-dots i:nth-child(3) { animation-delay: 0.3s; }

/* "Đang tải…" chỉ dành cho trình đọc màn hình; thông báo mạng chậm hiện thật sau 10 giây */
#splash-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
#splash #splash-slow { margin: 0; font-size: 12px; font-weight: 500; color: #475569; }
#splash [hidden] { display: none; }
.splash-noscript { margin: 10px 0 0; font-size: 12px; color: #b91c1c; }

.splash-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffffff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

@keyframes splash-float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.04); }
}
@keyframes splash-dot {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.45; }
  40% { transform: scale(1.15); opacity: 1; }
}

/* Điện thoại xoay ngang (chiều cao thấp) */
@media (max-height: 520px) {
  .splash-card { gap: 6px; padding: 12px 24px; transform: translateY(0); }
  .splash-logo { width: 96px; height: 96px; }
  .splash-title { font-size: 20px; margin: 2px 0 0; }
  .splash-title span {
  color: #f59e0b;
}
.splash-tagline { font-size: 11px; }
  .splash-dots { margin-top: 8px; }
  .splash-foot { bottom: max(6px, env(safe-area-inset-bottom)); }
}

/* Điện thoại nhỏ */
@media (max-width: 360px) {
  .splash-card { padding: 20px 20px 18px; transform: translateY(24px); }
  .splash-logo { width: 136px; height: 136px; }
  .splash-title { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  #splash { transition: none; }
  .splash-logo, .splash-dots i { animation: none; }
}
