:root {
  --splash-bg: #fdf9f4;
  --splash-green: #6f8a4a;
  --splash-green-light: #b8c9a0;
  --splash-pink: #c07a8f;
  --splash-text: #1f2937;
  --splash-text-secondary: #6b7280;
  --splash-border: #e8e8e4;
  --splash-track: #eceae4;
  --splash-white: #ffffff;
  --signing-bg: #fafaf8;
  --signing-card: #ffffff;
  --signing-border: #e5e7eb;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--splash-bg);
}

html.signing-direct,
html.signing-direct body {
  background: var(--signing-bg);
}

/* ── Workspace splash (default) ─────────────────────────────── */

#splash {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--splash-bg);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

#splash.splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

html.signing-direct #splash {
  display: none !important;
}

.splash-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(100%, 560px);
  min-height: 100%;
  padding: 12vh 24px 18vh;
  text-align: center;
}

.splash-logo {
  width: clamp(96px, 20vw, 120px);
  height: auto;
  margin-bottom: clamp(72px, 12vh, 120px);
}

.splash-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 360px);
}

.splash-guard-icon {
  width: 30px;
  height: 30px;
  margin-bottom: 16px;
  color: var(--splash-green);
}

.splash-status {
  margin: 0 0 18px;
  color: var(--splash-text);
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.splash-progress-track {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--splash-track);
}

.splash-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background-color: var(--splash-green);
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.18) 0,
    rgba(255, 255, 255, 0.18) 8px,
    transparent 8px,
    transparent 16px
  );
  transition: width 0.25s ease;
}

.splash-progress-percent {
  margin: 10px 0 0;
  color: var(--splash-green);
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

/* ── Signing splash (public /s/... links) ──────────────────── */

#signing-splash {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(184, 201, 160, 0.22), transparent 70%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(232, 180, 200, 0.16), transparent 65%),
    var(--signing-bg);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

html.signing-direct #signing-splash {
  display: flex;
}

#signing-splash.splash-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.signing-splash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(100%, 360px);
  padding: 40px 32px 36px;
  text-align: center;
  background: var(--signing-card);
  border: 1px solid var(--signing-border);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(31, 41, 55, 0.06);
}

.signing-splash-logo {
  width: 64px;
  height: auto;
  margin-bottom: 20px;
}

.signing-splash-doc {
  width: 48px;
  height: 56px;
  margin-bottom: 20px;
  color: var(--splash-green);
}

.signing-splash-doc svg {
  width: 100%;
  height: 100%;
  display: block;
}

.signing-splash-title {
  margin: 0 0 8px;
  color: var(--splash-text);
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.signing-splash-status {
  margin: 0 0 28px;
  color: var(--splash-text-secondary);
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.signing-splash-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--signing-border);
  border-top-color: var(--splash-green);
  border-radius: 50%;
  animation: signing-spin 0.85s linear infinite;
}

@keyframes signing-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 480px) {
  .splash-content {
    padding: 10vh 20px 14vh;
  }

  .splash-logo {
    margin-bottom: clamp(56px, 10vh, 88px);
  }

  .signing-splash-card {
    padding: 32px 24px 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #splash,
  #signing-splash,
  .splash-progress-fill {
    transition: none;
  }

  .signing-splash-spinner {
    animation: none;
    border-top-color: var(--splash-green);
    opacity: 0.7;
  }
}
