/* =====================================================================
   Samshield custom loading screen — MARKER: samshield-loader-v2
   Validated at build time by Deploy/validate-loader.sh.
   If you need to rework the loader, keep the #samshield-* selectors
   and at least one occurrence of "samshield-loader-v2" anywhere.
   ===================================================================== */

:root {
  --bg: #000000;
  --fg: #ffffff;
  --dim: rgba(255, 255, 255, 0.45);
  --track: rgba(255, 255, 255, 0.12);
  --accent: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 300;
  letter-spacing: 0.02em;
  overflow: hidden;
}

#unity-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

#unity-canvas {
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: block;
}

#samshield-loader {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: 24px;
  background: var(--bg);
  z-index: 10;
  transition: opacity 0.6s ease;
}

#samshield-loader.hidden {
  opacity: 0;
  pointer-events: none;
}

#samshield-logo {
  width: 140px;
  height: 140px;
  background: url('samshield-shield.png') no-repeat center / contain;
  opacity: 0;
  animation: fadeIn 1.2s ease-out 0.2s forwards;
  transform-origin: center;
}

#samshield-progress-track {
  width: 65vw;
  height: 2px;
  background: var(--track);
  position: relative;
  overflow: hidden;
}

#samshield-progress-fill {
  position: absolute;
  inset: 0;
  width: 0%;
  background: var(--accent);
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#samshield-phrase {
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg);
  display: flex;
  justify-content: center;
  align-items: baseline;
  min-height: 1.4em;
  opacity: 0;
  animation: fadeIn 1.2s ease-out 1.0s forwards;
  transition: opacity 0.4s ease;
}

#samshield-phrase.fading {
  opacity: 0;
}

/* Ellipsis dots: width:0 so the phrase text stays centered; dots overflow
   visibly to the right. Per-dot opacity animation = no reflow, fluid pulse. */
#samshield-ellipsis {
  width: 0;
  white-space: nowrap;
  overflow: visible;
  margin-left: 0.4em;
}
#samshield-ellipsis > span {
  display: inline-block;
  opacity: 0;
  margin-right: 0.35em;
  transition: opacity 0.4s ease;
}
#samshield-ellipsis > span:last-child { margin-right: 0; }
#samshield-ellipsis.active > span {
  animation: samEllipsisDot 1.4s infinite ease-in-out;
}
#samshield-ellipsis.active > span:nth-child(1) { animation-delay: 0s; }
#samshield-ellipsis.active > span:nth-child(2) { animation-delay: 0.2s; }
#samshield-ellipsis.active > span:nth-child(3) { animation-delay: 0.4s; }

@keyframes samEllipsisDot {
  0%, 80%, 100% { opacity: 0.15; }
  40%           { opacity: 1; }
}

#samshield-percent {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.12em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  animation: fadeIn 1.2s ease-out 1.4s forwards;
  transition: opacity 0.4s ease;
}

#samshield-debug {
  position: fixed;
  top: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.85);
  color: #0f0;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 10px;
  border: 1px solid rgba(0, 255, 0, 0.3);
  z-index: 100;
  max-width: 280px;
  pointer-events: none;
  white-space: pre;
}
#samshield-debug .row { display: block; }
#samshield-debug .key { color: #5fa; }
#samshield-debug .val { color: #fff; }
#samshield-debug .warn { color: #fa3; }

#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translate(-50%);
  background: white;
  padding: 10px;
  display: none;
  z-index: 20;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  #samshield-loader { gap: 24px; }
  #samshield-phrase { font-size: 12px; letter-spacing: 0.14em; }
  #samshield-logo { width: 110px; height: 110px; }
  #samshield-debug { font-size: 10px; max-width: 200px; padding: 6px 8px; }
}
