/* Login overlay: ported from the legacy auth gate, adapted to the current OlelaNK tokens. */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  overflow: hidden;
  color: var(--on-primary);
}

body.auth-open {
  overflow: hidden;
}

body.auth-guest [data-auth-only],
body.auth-guest [data-auth-panel] {
  display: none !important;
}

body.auth-authed [data-auth-guest-only] {
  display: none !important;
}

body.auth-open:not(.auth-cinematic) .app-shell,
body.auth-open:not(.auth-cinematic) .footer-squiggle,
body.auth-open:not(.auth-cinematic) .footer-light {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(10px) scale(0.992);
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.58s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.58s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.58s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.58s;
}

body.auth-closing:not(.auth-cinematic) .app-shell,
body.auth-closing:not(.auth-cinematic) .footer-squiggle,
body.auth-closing:not(.auth-cinematic) .footer-light {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0) scale(1);
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1) 0.08s,
    filter 0.72s cubic-bezier(0.22, 1, 0.36, 1) 0.08s,
    transform 0.72s cubic-bezier(0.22, 1, 0.36, 1) 0.08s;
}

body.auth-open .bg-wallpaper {
  transform: var(--auth-wallpaper-start, translateX(6%) scale(1.18));
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

body.auth-closing .bg-wallpaper {
  transform: scale(1.08);
  transition: transform 0.82s cubic-bezier(0.22, 1, 0.36, 1);
}

body.auth-cinematic .bg-wallpaper {
  transform: var(--auth-wallpaper-end, scale(1.08));
  transition: transform 3.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.bg-wallpaper {
  --auth-wallpaper-opacity: 1;
}

.bg-stars {
  --auth-stars-opacity: 0.4;
}

.hero-geo {
  --auth-hero-geo-opacity: 0.2;
}

body.auth-cinematic .bg-wallpaper.is-loaded {
  animation: auth-wallpaper-reveal 1.9s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
  will-change: opacity, transform;
}

body.auth-cinematic .bg-mask {
  animation: auth-bg-mask-reveal 1.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  will-change: opacity, filter;
}

body.auth-cinematic .bg-stars {
  animation: auth-stars-reveal 2.1s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both;
  will-change: opacity, transform, filter;
}

body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-geo {
  opacity: 0;
  filter:
    url("#brighten-add-50")
    drop-shadow(0 0 3px rgba(255, 255, 255, 0.7))
    drop-shadow(0 0 5px rgba(255, 255, 255, 0.4))
    blur(16px);
  transform: translateX(10%) translateY(28px) scale(1.035);
  animation: auth-hero-bg-enter 1.62s cubic-bezier(0.22, 1, 0.36, 1) 0.72s forwards;
  will-change: opacity, transform, filter;
}

@keyframes auth-wallpaper-reveal {
  0% { opacity: 0.28; }
  100% { opacity: var(--auth-wallpaper-opacity, 1); }
}

@keyframes auth-bg-mask-reveal {
  0% { opacity: 0.18; filter: blur(18px); }
  100% { opacity: 1; filter: blur(0); }
}

@keyframes auth-stars-reveal {
  0% { opacity: 0; filter: blur(10px); transform: scale(1.08); }
  100% { opacity: var(--auth-stars-opacity, 0.4); filter: blur(0); transform: scale(1); }
}

@keyframes auth-hero-bg-enter {
  0% {
    opacity: 0;
    filter:
      url("#brighten-add-50")
      drop-shadow(0 0 3px rgba(255, 255, 255, 0.7))
      drop-shadow(0 0 5px rgba(255, 255, 255, 0.4))
      blur(16px);
    transform: translateX(10%) translateY(28px) scale(1.035);
  }
  55% {
    opacity: var(--auth-hero-geo-opacity, 0.2);
  }
  100% {
    opacity: var(--auth-hero-geo-opacity, 0.2);
    filter:
      url("#brighten-add-50")
      drop-shadow(0 0 3px rgba(255, 255, 255, 0.7))
      drop-shadow(0 0 5px rgba(255, 255, 255, 0.4))
      blur(0);
    transform: translateX(6%) translateY(0) scale(1);
  }
}

body.auth-cinematic .nav-top,
body.auth-cinematic .tab-panel.is-active .panel-section > .container,
body.auth-cinematic .tab-panel.is-active .viewer-stage,
body.auth-cinematic .tab-panel.is-active .viewer-hud,
body.auth-cinematic .tab-panel.is-active .slots-panel {
  opacity: 0;
  transform: translateX(48px);
  filter: blur(10px);
  animation: auth-ui-enter 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: opacity, transform, filter;
}

body.auth-cinematic .nav-top {
  animation-delay: 0.9s;
}

body.auth-cinematic .tab-panel.is-active .panel-section > .container,
body.auth-cinematic .tab-panel.is-active .viewer-stage {
  animation-delay: 1.06s;
}

body.auth-cinematic .tab-panel.is-active .viewer-hud,
body.auth-cinematic .tab-panel.is-active .slots-panel {
  animation-delay: 1.18s;
}

@keyframes auth-ui-enter {
  from { opacity: 0; filter: blur(10px); transform: translateX(48px); }
  to { opacity: 1; filter: blur(0); transform: translateX(0); }
}

body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-eyebrow,
body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-sub,
body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-actions {
  opacity: 0;
  transform: translateX(42px);
  filter: blur(10px);
  animation: auth-hero-layer-enter 1.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  will-change: opacity, transform, filter;
}

body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-eyebrow {
  animation-delay: 0.96s;
}

body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-title {
  animation: none;
}

body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-title-line {
  opacity: 0;
  transform: translateX(48px);
  filter: blur(10px);
  animation: auth-hero-title-line-enter 1.18s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(1.08s + var(--line-delay, 0s));
  will-change: opacity, transform, filter;
}

body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-sub {
  animation-delay: 1.22s;
}

body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-actions {
  animation-delay: 1.36s;
}

@keyframes auth-hero-layer-enter {
  0% { opacity: 0; filter: blur(10px); transform: translateX(42px); }
  100% { opacity: 1; filter: blur(0); transform: translateX(0); }
}

@keyframes auth-hero-title-line-enter {
  0% { opacity: 0; filter: blur(10px); transform: translateX(48px); }
  100% { opacity: 1; filter: blur(0); transform: translateX(0); }
}

body.auth-open .auth-gate,
.auth-gate.is-visible {
  display: flex;
}

body.auth-entering .gate-veil {
  animation: gate-veil-in 0.72s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.auth-entering .gate-grain {
  animation: gate-grain-in 0.82s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.auth-entering .gate-bigtype {
  animation: gate-type-in 0.95s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.auth-entering .gate-lede {
  animation: gate-layer-in 0.82s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

body.auth-entering .gate-panel {
  animation: gate-layer-in 0.86s cubic-bezier(0.22, 1, 0.36, 1) 0.22s both;
}

body.auth-closing .auth-gate {
  pointer-events: none;
}

body.auth-closing .gate-veil,
body.auth-closing .gate-grain {
  opacity: 0;
  filter: blur(16px);
  transition:
    opacity 0.72s ease,
    filter 0.72s cubic-bezier(0.45, 0, 0.2, 1);
}

body.auth-closing .gate-bigtype {
  opacity: 0;
  filter: blur(14px);
  transform: translateX(10vw) translateY(2vh) scale(1.04);
  transition:
    opacity 0.72s ease,
    filter 0.72s cubic-bezier(0.45, 0, 0.2, 1),
    transform 0.78s cubic-bezier(0.45, 0, 0.2, 1);
}

body.auth-closing .gate-glow {
  opacity: 0;
  filter: blur(24px);
  transform: scale(1.12);
  transition:
    opacity 0.78s ease,
    filter 0.78s cubic-bezier(0.45, 0, 0.2, 1),
    transform 0.78s cubic-bezier(0.45, 0, 0.2, 1);
}

body.auth-closing .gate-lede {
  animation: gate-layer-out 0.58s cubic-bezier(0.45, 0, 0.2, 1) forwards;
}

body.auth-closing .gate-panel {
  animation: gate-layer-out 0.58s cubic-bezier(0.45, 0, 0.2, 1) 0.06s forwards;
}

body.auth-exiting .auth-gate {
  pointer-events: none;
}

@keyframes gate-veil-in {
  0% { opacity: 0; filter: blur(18px); }
  100% { opacity: 1; filter: blur(0); }
}

@keyframes gate-grain-in {
  0% { opacity: 0; transform: scale(1.04); }
  100% { opacity: 0.045; transform: scale(1); }
}

@keyframes gate-type-in {
  0% { opacity: 0; filter: blur(18px); transform: translateX(9vw) translateY(2vh) scale(1.04); }
  100% { opacity: 1; filter: blur(0); transform: translateX(0) translateY(0) scale(1); }
}

@keyframes gate-layer-in {
  0% { opacity: 0; filter: blur(14px); transform: translateY(28px) scale(0.985); }
  100% { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
}

@keyframes gate-layer-out {
  0% { opacity: 1; filter: blur(0); transform: translateY(0) scale(1); }
  100% { opacity: 0; filter: blur(14px); transform: translateY(-22px) scale(0.985); }
}

.gate-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(21, 15, 35, 0.9), rgba(31, 22, 51, 0.72)),
    rgba(21, 15, 35, 0.62);
  pointer-events: none;
}

.gate-glow {
  position: absolute;
  width: 90vmax;
  height: 90vmax;
  left: -28vmax;
  top: -34vmax;
  border-radius: 50%;
  background: radial-gradient(circle at center,
    rgba(194, 239, 78, 0.22) 0%,
    rgba(106, 95, 193, 0.14) 34%,
    transparent 64%);
  pointer-events: none;
  filter: blur(9px);
  will-change: transform;
  animation: gate-drift-a 19s ease-in-out infinite alternate;
}

.gate-glow.b2 {
  left: auto;
  top: auto;
  right: -34vmax;
  bottom: -40vmax;
  width: 80vmax;
  height: 80vmax;
  background: radial-gradient(circle at center,
    rgba(250, 127, 170, 0.15) 0%,
    rgba(106, 95, 193, 0.1) 35%,
    transparent 62%);
  animation: gate-drift-b 24s ease-in-out infinite alternate;
}

@keyframes gate-drift-a {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(5vw, 4vh) scale(1.16); }
}

@keyframes gate-drift-b {
  0% { transform: translate(0, 0) scale(1.05); }
  100% { transform: translate(-4vw, -3vh) scale(0.92); }
}

.gate-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.gate-bigtype {
  position: absolute;
  right: -2vw;
  bottom: -4vh;
  margin: 0;
  font-family: var(--font-display);
  font-size: 360px;
  font-weight: 700;
  line-height: 0.78;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.06);
  text-align: right;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  will-change: transform;
}

.gate-bigtype-inner {
  display: inline-block;
  transform-origin: 80% 80%;
  will-change: transform;
  animation: gate-warp 17s ease-in-out infinite;
}

.gate-bigtype .nk {
  color: rgba(194, 239, 78, 0.18);
}

@keyframes gate-warp {
  0% { transform: translateY(0) skewX(0deg) scale(1); }
  50% { transform: translateY(-1.4vh) skewX(-1.6deg) scale(1.018); }
  100% { transform: translateY(0) skewX(0deg) scale(1); }
}

.gate-content {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-xxl);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(32px, 8vh, 96px) clamp(16px, 4vw, var(--space-xl));
}

.gate-lede {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.gate-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--on-dark-muted);
}

.gate-eyebrow .bar {
  width: 36px;
  height: 1px;
  background: var(--accent-lime);
  display: inline-block;
}

.gate-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 132px;
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: 0;
  color: var(--on-primary);
}

.gate-brand .nk {
  color: var(--accent-lime);
}

.gate-tagline {
  margin: 0;
  color: var(--on-dark-muted);
  max-width: 40ch;
}

.gate-panel {
  width: 100%;
  max-width: 390px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--rounded-md);
  background: rgba(31, 22, 51, 0.72);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

.gate-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-md);
}

.gate-title {
  margin: 0;
}

.gate-panel-sub {
  color: var(--accent-violet-mid);
}

.gate-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--rounded-full);
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-primary);
  cursor: pointer;
}

.gate-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.gate-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.gate-field-label {
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--accent-violet-mid);
}

.gate-input {
  width: 100%;
  min-height: 44px;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--rounded-sm);
  background: rgba(21, 15, 35, 0.52);
  color: var(--on-primary);
  font-family: var(--font-ui);
  font-size: 16px;
  outline: none;
}

.gate-input::placeholder {
  color: var(--accent-violet-mid);
}

.gate-input:focus {
  border-color: var(--accent-lime);
  box-shadow: 0 0 0 2px rgba(194, 239, 78, 0.18);
}

.gate-input:-webkit-autofill,
.gate-input:-webkit-autofill:hover {
  -webkit-text-fill-color: var(--on-primary);
  -webkit-box-shadow: none;
  caret-color: var(--on-primary);
  transition: background-color 9999s ease-in-out 0s;
  animation-name: onAutoFillStart;
  animation-duration: 0.001s;
}

.gate-input:not(:-webkit-autofill) {
  animation-name: onAutoFillCancel;
  animation-duration: 0.001s;
}

@keyframes onAutoFillStart { from {} to {} }
@keyframes onAutoFillCancel { from {} to {} }

.gate-block {
  width: 100%;
}

.gate-msg {
  display: none;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--rounded-sm);
  font-size: 13px;
  line-height: 1.4;
}

.gate-msg.is-error {
  display: block;
  background: rgba(255, 107, 138, 0.12);
  border: 1px solid rgba(255, 107, 138, 0.34);
  color: #ffd6df;
}

.gate-msg.is-success {
  display: block;
  background: rgba(194, 239, 78, 0.12);
  border: 1px solid rgba(194, 239, 78, 0.3);
  color: var(--accent-lime);
}

.gate-readout {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.gate-ro {
  display: flex;
  align-items: baseline;
  gap: var(--space-xs);
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.4;
  text-transform: uppercase;
}

.gate-ro .k {
  color: var(--accent-violet-mid);
}

.gate-ro .v {
  color: var(--on-dark-muted);
}

.gate-ro .v.ok,
.gate-ro .v.accent {
  color: var(--accent-lime);
}

.gate-panel.shake {
  animation: gate-shake 0.4s ease;
}

@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

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

body.auth-exiting .gate-veil,
body.auth-exiting .gate-grain {
  opacity: 0;
  filter: blur(14px);
  transition:
    opacity 1.4s ease,
    filter 1.4s cubic-bezier(0.5, 0, 0.2, 1);
}

body.auth-exiting .gate-bigtype {
  transform: translateX(var(--gate-exit-x, -100vw));
  filter: blur(12px);
  transition:
    transform 3s cubic-bezier(0.5, 0, 0.2, 1),
    filter 1.65s cubic-bezier(0.5, 0, 0.2, 1);
}

body.auth-exiting [data-exit-brand] {
  transform: translateX(var(--brand-exit-x, -100vw));
  filter: blur(12px);
  transition:
    transform 3s cubic-bezier(0.5, 0, 0.2, 1),
    filter 1.55s cubic-bezier(0.5, 0, 0.2, 1);
}

body.auth-exiting [data-exit] {
  animation: gate-leave 1.4s cubic-bezier(0.5, 0, 0.2, 1) var(--de, 0s) forwards;
}

@keyframes gate-leave {
  0% { opacity: 1; filter: blur(0); transform: translateX(0); }
  100% { opacity: 0; filter: blur(12px); transform: translateX(-160px); }
}

body.auth-exiting .gate-glow {
  opacity: 0;
  filter: blur(18px);
  transition:
    opacity 2.4s ease,
    filter 2.4s cubic-bezier(0.5, 0, 0.2, 1);
}

@media (prefers-reduced-motion: reduce) {
  .gate-glow,
  .gate-glow.b2,
  .gate-bigtype,
  .gate-bigtype-inner,
  .gate-lede,
  .gate-panel {
    animation: none !important;
  }

  body.auth-exiting .gate-bigtype,
  body.auth-exiting [data-exit-brand],
  body.auth-exiting [data-exit],
  body.auth-exiting .gate-veil,
  body.auth-exiting .gate-glow,
  body.auth-cinematic .nav-top,
  body.auth-cinematic .tab-panel.is-active .panel-section > .container,
  body.auth-cinematic .tab-panel.is-active .viewer-stage,
  body.auth-cinematic .tab-panel.is-active .viewer-hud,
  body.auth-cinematic .tab-panel.is-active .slots-panel,
  body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-eyebrow,
  body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-title-line,
  body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-sub,
  body.auth-cinematic .tab-panel[data-tab="overview"].is-active .hero-actions {
    animation: none !important;
    transition: opacity 0.3s ease !important;
    filter: none !important;
    transform: none !important;
  }
}

@media (max-width: 640px) {
  .gate-content {
    padding: var(--space-xxl) var(--space-lg);
    gap: var(--space-xl);
  }

  .gate-bigtype {
    font-size: 132px;
    bottom: -2vh;
  }

  .gate-brand {
    font-size: 64px;
  }

  .gate-panel {
    max-width: 100%;
  }
}

@media (min-width: 641px) and (max-width: 991px) {
  .gate-bigtype {
    font-size: 220px;
  }

  .gate-brand {
    font-size: 92px;
  }
}
