body {
  margin: 0;
  padding: 0;
}

/* ── Pulse Grid (final) ──────────────────────────────────────────
   Terminal-style dot grid, ring timer around the mark, staggered
   ALIS wordmark. Follows data-bs-theme: light or dark. */

.splash-screen {
  position: absolute;
  z-index: 1000;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Poppins', Helvetica, sans-serif;
  overflow: hidden;
  animation: splash-fade-in 0.4s ease-out;

  /* light theme (default) */
  --sp-bg: #f8fafc;
  --sp-dot: rgba(30, 58, 95, 0.13);
  --sp-word-from: #1e3a5f;
  --sp-word-to: #3b82f6;
  --sp-mark-op: 0.9;
  --sp-ring-track: rgba(30, 58, 95, 0.12);
  --sp-ring-fill: #3b82f6;
  --sp-byline: rgba(30, 58, 95, 0.45);
  --sp-label: rgba(30, 58, 95, 0.6);
  --sp-track-bg: rgba(30, 58, 95, 0.12);
  --sp-version: rgba(30, 58, 95, 0.35);

  background: var(--sp-bg);
  color: var(--sp-label);
}

html[data-bs-theme="dark"] .splash-screen {
  --sp-bg: #0c1a2e;
  --sp-dot: rgba(147, 197, 253, 0.16);
  --sp-word-from: #ffffff;
  --sp-word-to: #93c5fd;
  --sp-ring-track: rgba(147, 197, 253, 0.14);
  --sp-byline: rgba(226, 232, 240, 0.45);
  --sp-label: rgba(226, 232, 240, 0.7);
  --sp-track-bg: rgba(255, 255, 255, 0.1);
  --sp-version: rgba(226, 232, 240, 0.35);
}

@keyframes splash-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* dot-grid backdrop, dimmed toward edges */
.splash-screen__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(var(--sp-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, #000 30%, transparent 78%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 42%, #000 30%, transparent 78%);
}

/* soft vignette glow behind the brand */
.splash-screen__glow {
  position: absolute;
  top: 42%;
  left: 50%;
  width: 60vmax;
  height: 40vmax;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.14), transparent 65%);
}

html[data-bs-theme="dark"] .splash-screen__glow {
  background: radial-gradient(ellipse, rgba(59, 130, 246, 0.2), transparent 65%);
}

html[data-bs-theme="dark"] .splash-screen__logo {
  filter: brightness(0) invert(1);
}

.splash-screen__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: splash-rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes splash-rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.splash-screen__scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 3.2rem;
}

.splash-screen__brand {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

/* ring timer around the mark */
.splash-screen__ring {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
}

.splash-screen__ring-svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.splash-screen__ring-track {
  fill: none;
  stroke: var(--sp-ring-track);
  stroke-width: 2;
}

.splash-screen__ring-fill {
  fill: none;
  stroke: var(--sp-ring-fill);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 64 216;
  animation: splash-ring-spin 2.4s linear infinite;
}

@keyframes splash-ring-spin {
  to { stroke-dashoffset: -280; }
}

.splash-screen__logo {
  width: 44px;
  height: auto;
  opacity: var(--sp-mark-op);
}

/* wordmark — letters stagger in */
.splash-screen__wordmark {
  font-size: clamp(3.4rem, 9vw, 5rem);
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1;
}

.splash-screen__wordmark .wl {
  display: inline-block;
  background: linear-gradient(120deg, var(--sp-word-from) 20%, var(--sp-word-to) 85%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  opacity: 0;
  transform: translateY(0.35em);
  animation: splash-letter 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.splash-screen__wordmark .wl:nth-child(1) { animation-delay: 0.15s; }
.splash-screen__wordmark .wl:nth-child(2) { animation-delay: 0.27s; }
.splash-screen__wordmark .wl:nth-child(3) { animation-delay: 0.39s; }
.splash-screen__wordmark .wl:nth-child(4) { animation-delay: 0.51s; }

@keyframes splash-letter {
  to { opacity: 1; transform: translateY(0); }
}

.splash-screen__byline {
  margin-top: 0.55rem;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--sp-byline);
}

/* status label — cross-fade driven by the inline script */
.splash-screen__label {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: var(--sp-label);
  margin-bottom: 1.4rem;
  min-height: 1.2em;
  text-align: center;
  transition: opacity 0.35s ease;
}

/* hairline track with glowing head */
.splash-screen__bar {
  position: relative;
  width: min(420px, 76vw);
  height: 2px;
  border-radius: 999px;
  background: var(--sp-track-bg);
  overflow: visible;
}

.splash-screen__bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 45%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #60a5fa 75%, #93c5fd);
  animation: splash-track 1.7s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.splash-screen__bar-fill::after {
  content: '';
  position: absolute;
  right: -3px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #bfdbfe;
  box-shadow: 0 0 10px 2px rgba(147, 197, 253, 0.9);
  transform: translateY(-50%);
}

@keyframes splash-track {
  0%   { left: -45%; }
  60%  { left: 100%; }
  100% { left: 100%; }
}

.splash-screen__version {
  position: absolute;
  bottom: 1.6rem;
  right: 1.8rem;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--sp-version);
}

@media (prefers-reduced-motion: reduce) {
  .splash-screen__ring-fill { animation: none; }
  .splash-screen__wordmark .wl { animation: none; opacity: 1; transform: none; }
  .splash-screen__bar-fill { animation: splash-track 1.7s linear infinite; }
}
