/* Auth velvet backdrop — loaded before React to prevent color flash. */

#kos-auth-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background: #0c0a09;
}

#kos-auth-backdrop[hidden] {
  display: none !important;
}

#kos-auth-backdrop:not(.is-ready) .kos-pin-screen__orb,
#kos-auth-backdrop:not(.is-ready) .kos-pin-screen__ribbon {
  opacity: 0 !important;
}

body.kos-auth-route,
body.kos-auth-route #root,
body.kos-auth-route #app-container {
  background-color: transparent !important;
}

body.kos-auth-route {
  overflow: hidden;
  overscroll-behavior: none;
  background-color: #0c0a09 !important;
}

html.kos-auth-route,
html.kos-auth-route body {
  background-color: #0c0a09;
}

body.kos-auth-route #root,
body.kos-auth-route #app-container {
  min-height: var(--app-vh, 100vh);
  max-height: var(--app-vh, 100vh);
  overflow: hidden;
}

#kos-auth-backdrop,
#kos-auth-backdrop::before,
#kos-auth-backdrop::after,
#kos-auth-backdrop .kos-pin-screen__stars,
#kos-auth-backdrop .kos-pin-screen__orb,
#kos-auth-backdrop .kos-pin-screen__ribbon {
  will-change: auto;
}

html.kos-keyboard-open #kos-auth-backdrop,
html.kos-keyboard-open #kos-auth-backdrop::before,
html.kos-keyboard-open #kos-auth-backdrop::after,
html.kos-keyboard-open #kos-auth-backdrop .kos-pin-screen__stars,
html.kos-keyboard-open #kos-auth-backdrop .kos-pin-screen__orb,
html.kos-keyboard-open #kos-auth-backdrop .kos-pin-screen__ribbon,
html.kos-pin-keyboard-open #kos-auth-backdrop,
html.kos-pin-keyboard-open #kos-auth-backdrop::before,
html.kos-pin-keyboard-open #kos-auth-backdrop::after,
html.kos-pin-keyboard-open #kos-auth-backdrop .kos-pin-screen__stars,
html.kos-pin-keyboard-open #kos-auth-backdrop .kos-pin-screen__orb,
html.kos-pin-keyboard-open #kos-auth-backdrop .kos-pin-screen__ribbon {
  transform: translateZ(0);
}

#kos-auth-backdrop .kos-pin-screen__stars,
#kos-auth-backdrop .kos-pin-screen__orb,
#kos-auth-backdrop .kos-pin-screen__ribbon {
  pointer-events: none;
  position: fixed;
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* Soft warm dust — not blue starfield */
#kos-auth-backdrop .kos-pin-screen__stars {
  inset: 0;
  opacity: 0.35;
  background-image:
    radial-gradient(circle at 18% 14%, rgba(232, 212, 139, 0.55) 0, rgba(232, 212, 139, 0.55) 0.6px, transparent 0.9px),
    radial-gradient(circle at 74% 22%, rgba(255, 244, 220, 0.4) 0, rgba(255, 244, 220, 0.4) 0.55px, transparent 0.85px),
    radial-gradient(circle at 42% 58%, rgba(201, 162, 39, 0.35) 0, rgba(201, 162, 39, 0.35) 0.55px, transparent 0.85px),
    radial-gradient(circle at 88% 68%, rgba(255, 240, 210, 0.3) 0, rgba(255, 240, 210, 0.3) 0.5px, transparent 0.8px),
    radial-gradient(circle at 10% 78%, rgba(232, 212, 139, 0.4) 0, rgba(232, 212, 139, 0.4) 0.55px, transparent 0.85px),
    radial-gradient(circle at 56% 34%, rgba(201, 162, 39, 0.28) 0, rgba(201, 162, 39, 0.28) 0.5px, transparent 0.8px);
  background-size: 280px 280px;
}

#kos-auth-backdrop::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 85% 55% at 50% 32%, rgba(201, 162, 39, 0.14) 0%, transparent 58%),
    radial-gradient(ellipse 110% 70% at 50% 110%, rgba(60, 28, 12, 0.55) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 18% 78%, rgba(90, 40, 18, 0.22) 0%, transparent 60%),
    linear-gradient(180deg, #1a120c 0%, #0c0a09 52%, #080706 100%);
}

/* Fine grain overlay */
#kos-auth-backdrop::after {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  pointer-events: none;
  mix-blend-mode: overlay;
}

#kos-auth-backdrop .kos-pin-screen__orb {
  border-radius: 9999px;
}

#kos-auth-backdrop .kos-pin-screen__orb--left {
  top: 8%;
  left: -38%;
  width: calc(var(--app-vh-stable, var(--app-vh, 100vh)) * 0.88);
  height: calc(var(--app-vh-stable, var(--app-vh, 100vh)) * 0.88);
  background: radial-gradient(
    circle at 62% 48%,
    rgba(201, 162, 39, 0.28) 0%,
    rgba(120, 70, 24, 0.16) 32%,
    rgba(40, 22, 12, 0.06) 55%,
    transparent 72%
  );
  filter: blur(22px);
  opacity: 0.9;
}

#kos-auth-backdrop .kos-pin-screen__orb--right {
  right: -40%;
  bottom: 4%;
  width: calc(var(--app-vh-stable, var(--app-vh, 100vh)) * 0.92);
  height: calc(var(--app-vh-stable, var(--app-vh, 100vh)) * 0.92);
  background: radial-gradient(
    circle at 38% 52%,
    rgba(140, 55, 28, 0.32) 0%,
    rgba(90, 36, 18, 0.16) 34%,
    rgba(30, 16, 10, 0.05) 56%,
    transparent 74%
  );
  filter: blur(24px);
  opacity: 0.85;
}

#kos-auth-backdrop .kos-pin-screen__orb--center {
  top: 24%;
  left: 50%;
  width: calc(var(--app-vh-stable, var(--app-vh, 100vh)) * 0.7);
  height: calc(var(--app-vh-stable, var(--app-vh, 100vh)) * 0.5);
  transform: translateX(-50%);
  background: radial-gradient(
    ellipse at center,
    rgba(232, 212, 139, 0.1) 0%,
    rgba(201, 162, 39, 0.05) 42%,
    transparent 72%
  );
  filter: blur(36px);
  opacity: 0.8;
}

#kos-auth-backdrop .kos-pin-screen__ribbon {
  border-radius: 9999px;
  filter: blur(52px);
}

#kos-auth-backdrop .kos-pin-screen__ribbon--left {
  top: 4%;
  left: -30%;
  width: 72%;
  height: 34%;
  transform: rotate(-12deg);
  background: radial-gradient(circle, rgba(201, 162, 39, 0.22) 0%, rgba(201, 162, 39, 0.04) 68%, transparent 100%);
  opacity: 0.65;
}

#kos-auth-backdrop .kos-pin-screen__ribbon--right {
  right: -32%;
  bottom: 4%;
  width: 74%;
  height: 36%;
  transform: rotate(10deg);
  background: radial-gradient(circle, rgba(120, 48, 22, 0.28) 0%, rgba(80, 32, 16, 0.06) 70%, transparent 100%);
  opacity: 0.6;
}

#app-container {
  position: relative;
  z-index: 1;
}

.kos-pin-screen--overlay {
  position: relative;
  z-index: 1;
  min-height: var(--app-vh, 100vh);
  overflow: hidden;
  background: transparent !important;
}

.kos-pin-screen--overlay::before {
  display: none !important;
}
