/* ============================================================
   Tela de carregamento — V2 GRAFITE + ÂMBAR glass.
   Mesmas classes do original (.splash-*), HTML não muda.
   Glow âmbar suave no logo, nome em fade+grow, pontos como
   progresso indeterminado. Mantém HUD (colchetes + scanlines +
   holograma) atrás do #splash e da barra com trilho/fill.
   O texto de etapa (.splash-etapa) cicla por JS.
   CSS bloqueante no head: pinta antes de o app carregar.
   ============================================================ */
#splash {
  position: fixed;
  inset: 0;
  z-index: 999;
  background:
    radial-gradient(ellipse 70% 50% at 50% 30%, var(--luz-quina), transparent 65%),
    linear-gradient(180deg, var(--vidro), transparent 240px),
    var(--fundo);
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: opacity 0.6s ease, transform 0.6s ease, filter 0.6s ease, visibility 0s linear 0.6s;
  will-change: opacity, transform;
  contain: paint;
}
#splash.saindo {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: scale(1.06);
  filter: blur(8px);
}
/* scanlines + vinheta CRT por cima */
#splash::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    repeating-linear-gradient(0deg, var(--veu-scanline) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 120% 90% at 50% 50%, transparent 50%, var(--veu-vinheta) 100%);
  opacity: 0.85;
}
/* quatro colchetes HUD nos cantos da tela */
#splash::before {
  content: "";
  position: absolute;
  inset: 22px;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(var(--acento), var(--acento)) top left / 22px 2px no-repeat,
    linear-gradient(var(--acento), var(--acento)) top left / 2px 22px no-repeat,
    linear-gradient(var(--acento), var(--acento)) top right / 22px 2px no-repeat,
    linear-gradient(var(--acento), var(--acento)) top right / 2px 22px no-repeat,
    linear-gradient(var(--acento), var(--acento)) bottom left / 22px 2px no-repeat,
    linear-gradient(var(--acento), var(--acento)) bottom left / 2px 22px no-repeat,
    linear-gradient(var(--acento), var(--acento)) bottom right / 22px 2px no-repeat,
    linear-gradient(var(--acento), var(--acento)) bottom right / 2px 22px no-repeat;
  filter: none;
  opacity: 0.7;
}
.splash-cena {
  perspective: 1000px;
  perspective-origin: 50% 42%;
  text-align: center;
  padding: 20px;
  position: relative;
  z-index: 2;
}
/* ---------- glow âmbar suave (spec §4: glow contido no splash) ---------- */
.splash-holo {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
  transform-style: preserve-3d;
  animation: splash-levitar 4s ease-in-out infinite;
}
.splash-holo .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--acento);
  transform: rotateX(70deg);
  animation: splash-girar 4s linear infinite;
  opacity: 0.6;
}
.splash-holo .ring.r2 {
  inset: 12px;
  border-color: var(--acento-2);
  animation-duration: 2.8s;
  animation-direction: reverse;
}
.splash-holo .core {
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--papel), var(--acento) 45%, transparent 75%);
  font-family: var(--font-display, sans-serif);
  font-weight: 700;
  font-size: 20px;
  color: var(--texto-sobre-acento);
  animation: splash-pulso 2s ease-in-out infinite;
  /* glow âmbar suave e contido, só aqui e nos estados ativos */
  box-shadow: 0 0 28px var(--brilho-ambar-suave), 0 0 72px var(--brilho-ambar-suave);
}
.splash-holo .core::before {
  content: "MD";
}
@keyframes splash-levitar {
  0%, 100% { transform: translateY(0) rotateX(-6deg); }
  50%      { transform: translateY(-8px) rotateX(6deg); }
}
@keyframes splash-girar {
  to { transform: rotateX(70deg) rotateZ(360deg); }
}
@keyframes splash-pulso {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.12); }
}
/* ---------- nome em fade+grow (spec §6) ---------- */
.splash-nome {
  position: relative;
  display: inline-block;
  animation: splash-nome 0.8s ease both;
  transform-origin: 50% 50%;
}
@keyframes splash-nome {
  from { opacity: 0; transform: scale(0.94) translateY(4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.splash-frente {
  font-size: clamp(30px, 7vw, 52px);
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
  text-transform: uppercase;
  font-family: var(--font-display, sans-serif);
  color: var(--texto);
}
.splash-reflexo {
  display: none;
}
/* ---------- especialidade / subtitulo ---------- */
.splash-especialidade {
  margin: 14px 0 0;
  font-size: clamp(8px, 1.6vw, 11px);
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--acento-2);
  font-family: var(--font-mono, monospace);
  opacity: 0;
  animation: splash-acender 0.8s ease forwards;
  animation-delay: 0.4s;
}
@keyframes splash-acender {
  from { opacity: 0; letter-spacing: 0.7em; }
  to   { opacity: 0.8; letter-spacing: 0.4em; }
}
/* ---------- etapa (cicla por JS) ---------- */
.splash-etapa {
  margin: 18px 0 0;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--texto-3);
  font-family: var(--font-mono, monospace);
  min-height: 12px;
  transition: opacity 0.2s ease;
}
.splash-etapa b {
  color: var(--acento-2);
  font-weight: 600;
}
/* ---------- barra de progresso ---------- */
.splash-progresso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: clamp(200px, 46vw, 320px);
  margin: 22px auto 0;
  opacity: 0;
  animation: splash-acenderBarra 0.8s ease forwards;
  animation-delay: 0.7s;
}
@keyframes splash-acenderBarra {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.splash-progresso-trilho {
  position: relative;
  flex: 1;
  height: 3px;
  overflow: hidden;
  background: var(--vidro-forte);
  border-radius: 999px;
}
.splash-progresso-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 8%;
  background: linear-gradient(90deg, var(--acento) 0%, var(--acento-2) 100%);
  transition: width 0.18s linear;
  will-change: width;
}
/* ponto pulsante na ponta */
.splash-progresso-fill::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  transform: translateY(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--papel);
  box-shadow: 0 0 10px 3px var(--acento);
  animation: splash-ponta 1s ease-in-out infinite;
}
@keyframes splash-ponta {
  0%, 100% { opacity: 1; transform: translateY(-50%) scale(1); }
  50%      { opacity: 0.4; transform: translateY(-50%) scale(1.6); }
}
/* estado indeterminado: se o JS travar, nao fica parado */
.splash-progresso-fill.indeterminado {
  width: 35% !important;
  transition: none;
  animation: splash-indeterminado 1.1s ease-in-out infinite;
}
@keyframes splash-indeterminado {
  0%   { transform: translateX(-130%); }
  100% { transform: translateX(300%); }
}
.splash-progresso-brilho {
  display: none;
}
.splash-progresso-numero {
  min-width: 42px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  font-family: var(--font-mono, monospace);
  font-variant-numeric: tabular-nums;
  color: var(--acento);
  text-align: right;
}
/* ---------- pontos · como progresso indeterminado (spec §6) ----------
   Os pontos pulsando garantem que o splash nunca pareça travado
   mesmo com o JS travado: o estado é indeterminado, sempre vivo. */
.splash-progresso::after {
  content: "· · ·";
  flex: none;
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.2em;
  color: var(--acento-2);
  animation: splash-pontos 1.2s ease-in-out infinite;
}
.splash-pontos {
  color: var(--acento-2);
  animation: splash-pontos 1.2s ease-in-out infinite;
}
@keyframes splash-pontos {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}
/* ---------- erro ---------- */
.splash-erro {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  color: var(--texto);
  background: var(--veu-janela);
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.splash-erro.on {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}
.splash-erro div {
  max-width: 380px;
  border: 1px solid var(--borda-perigo);
  padding: 24px;
  background: var(--superficie-2);
  box-shadow: 0 0 30px var(--borda-perigo);
}
.splash-erro strong {
  display: block;
  font-size: 16px;
  margin-bottom: 10px;
  color: var(--perigo);
  font-family: var(--font-display, sans-serif);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.splash-erro p {
  font-size: 13px;
  line-height: 1.7;
  opacity: 0.85;
}
.splash-erro code {
  background: var(--vidro-forte);
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 12px;
  font-family: var(--font-mono, monospace);
}
.splash-erro button {
  margin-top: 20px;
  background: var(--perigo);
  color: var(--fundo);
  border: 0;
  border-radius: var(--raio);
  padding: 11px 24px;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 11px;
  cursor: pointer;
  box-shadow: var(--elev-1);
  font-family: var(--font-display, sans-serif);
}
.splash-erro button:hover {
  filter: brightness(1.15);
}
@media (prefers-reduced-motion: reduce) {
  .splash-holo,
  .splash-especialidade,
  .splash-progresso,
  .splash-nome {
    animation: none;
  }
  /* V2: nome já visível e pontos estáticos, sem fade+grow nem pulso. */
  .splash-nome { opacity: 1; transform: none; }
  .splash-progresso::after,
  .splash-pontos { animation: none; opacity: 0.8; }
  .splash-holo { transform: none; }
  .splash-holo .ring,
  .splash-holo .core { animation: none; }
  .splash-especialidade { opacity: 0.8; letter-spacing: 0.4em; }
  .splash-progresso { opacity: 1; }
  .splash-progresso-brilho {
    display: none;
  }
  .splash-progresso-fill.indeterminado,
  .splash-progresso-fill::after,
  #splash::after {
    display: none;
    animation: none;
  }
  .splash-progresso-fill { transition: none; }
}
