.is-unlocked .login {
  display: none;
}

.login {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  --login-frame-x: clamp(20px, 6vw, 86px);
  --login-frame-y: clamp(20px, 4.5vh, 52px);
  padding: 32px 20px;
  background: var(--bg);
  transition: opacity 1s cubic-bezier(.4, 0, .2, 1);
}

.login--leaving {
  opacity: 0;
  pointer-events: none;
}

.login--leaving .login__content {
  transform: scale(.96) translateY(-12px);
  filter: blur(4px);
  transition: transform 1s cubic-bezier(.4, 0, .2, 1), filter 1s ease;
}

.login__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(900px, 110vw);
  height: min(620px, 80vh);
  transform: translate(-50%, -55%);
  background: radial-gradient(ellipse 50% 50% at 50% 42%, rgba(0, 255, 222, .08) 0%, rgba(127, 150, 218, .05) 38%, transparent 100%);
  pointer-events: none;
}

/* ── Background scene: drifting aurora, dot grid, one-off light sweep and a
   rotating HUD frame — a "state of the art" feel behind the login
   content, all ambient (no slide--play gate: it has to run the moment the page loads). */
@property --login-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

.login__scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.login__aurora {
  position: absolute;
  inset: 0;
}

.login__aurora::before,
.login__aurora::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}

.login__aurora::before {
  top: -32%;
  left: -18%;
  width: min(900px, 80vw);
  height: min(780px, 70vw);
  background: radial-gradient(closest-side, rgba(0, 255, 222, .16), rgba(0, 255, 222, .05) 55%, transparent);
  animation: login-aurora-drift 19s ease-in-out infinite alternate;
}

.login__aurora::after {
  right: -22%;
  bottom: -36%;
  width: min(950px, 85vw);
  height: min(820px, 75vw);
  background: radial-gradient(closest-side, rgba(127, 150, 218, .16), rgba(127, 150, 218, .04) 55%, transparent);
  animation: login-aurora-drift 24s ease-in-out infinite alternate-reverse;
}

.login__grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1.2px, transparent 1.8px);
  background-size: 34px 34px;
  -webkit-mask-image: radial-gradient(ellipse 55% 48% at 50% 46%, transparent 0%, #000 68%);
  mask-image: radial-gradient(ellipse 55% 48% at 50% 46%, transparent 0%, #000 68%);
}

.login__sweep {
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: 0;
  width: 420px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 222, .07) 30%, rgba(182, 255, 244, .16) 50%, rgba(0, 255, 222, .07) 70%, transparent);
  opacity: 0;
  transform: translateX(-520px) skewX(-14deg);
  animation: login-sweep 3.6s ease-in-out .4s both;
}

.login__frame {
  position: absolute;
  inset: var(--login-frame-y) var(--login-frame-x);
  padding: 1.5px;
  border-radius: 28px;
  background: conic-gradient(from var(--login-angle), rgba(0, 255, 222, .1) 0deg, rgba(0, 255, 222, .1) 230deg, rgba(0, 255, 222, .55) 300deg, #B6FFF4 335deg, rgba(0, 255, 222, .1) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: login-frame-spin 11s linear infinite;
  opacity: .8;
}

.login__content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(100vw - 2 * var(--login-frame-x) - 48px);
  text-align: center;
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
}

.login__logo {
  display: block;
  width: auto;
  height: clamp(18px, 2.2vw, 28px);
  margin-bottom: clamp(26px, 4vh, 42px);
  opacity: 0;
  animation: login-logo-in 1.1s ease .2s both;
}

.login__title {
  font-size: clamp(30px, 4.8vw, 76px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -.01em;
  color: var(--ink);
  opacity: 0;
  animation: login-title-in 2.7s cubic-bezier(.22, 1, .36, 1) .7s both;
}

.login__subtitle {
  margin-top: clamp(20px, 2.6vh, 28px);
  font-size: clamp(20px, 1.9vw, 27px);
  font-weight: 400;
  color: var(--muted);
}

.login__word {
  display: inline-block;
  opacity: 0;
  animation: login-word-in .5s ease calc(2.3s + var(--i) * .17s) both;
}

.login__start {
  position: relative;
  margin-top: clamp(32px, 5vh, 48px);
  width: clamp(96px, 8.5vw, 118px);
  height: clamp(96px, 8.5vw, 118px);
  border-radius: 50%;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  background:
    radial-gradient(circle at 42% 36%, rgba(255, 255, 255, .045) 0%, transparent 52%),
    radial-gradient(circle at 50% 50%, #161616 0%, #0B0B0B 65%, #050505 100%);
  border: 1.5px solid rgba(0, 255, 222, .42);
  transition: border-color .35s, transform .22s, opacity .3s;
  opacity: 0;
  animation: login-pop 1s cubic-bezier(.34, 1.56, .64, 1) 5.5s both, login-start-glow 3.5s ease-in-out 6.5s infinite;
}

.login__start:hover {
  border-color: rgba(0, 255, 222, .72);
  transform: scale(1.05);
}

.login__start:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
}

.login__start-label {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: clamp(11px, .9vw, 13px);
  font-weight: 500;
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(0, 255, 222, .85);
}

.login__start-hint {
  margin-top: 22px;
  font-size: clamp(13px, 1vw, 15px);
  letter-spacing: .5px;
  color: rgba(238, 238, 238, .6);
  opacity: 0;
  animation: login-fade-up .8s 6.6s ease-out forwards;
}

.login__notice {
  position: absolute;
  left: 50%;
  bottom: calc(var(--login-frame-y) + clamp(16px, 3vh, 30px));
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: calc(100vw - 2 * var(--login-frame-x) - 32px);
  padding: 8px 16px;
  border: 1px solid rgba(0, 255, 222, .22);
  border-radius: 999px;
  background: rgba(0, 255, 222, .04);
  font-family: var(--font-mono);
  font-size: clamp(10px, .8vw, 12.5px);
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  color: rgba(238, 238, 238, .6);
  transform: translateX(-50%);
  opacity: 0;
  animation: login-fade-in .8s ease 1.2s both;
}

.login__notice-text {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: .6em;
}

.login__notice-text span {
  white-space: nowrap;
}

.login__notice-icon {
  flex: none;
  width: 13px;
  height: 13px;
  color: var(--accent);
}

.login__input {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  pointer-events: none;
}

.login__flash {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at center, rgba(0, 255, 222, .15), transparent 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}

.login__flash--on {
  opacity: 1;
  transition: opacity .04s;
}

.code {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: login-fade-up .4s ease-out both;
}

.code__label-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.code__label-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.code__lock {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: .5;
  transition: opacity .4s;
}

.code__label {
  font-size: clamp(14px, 1.1vw, 16px);
  letter-spacing: .5px;
  color: rgba(238, 238, 238, .55);
  transition: color .4s;
}

.code__label em {
  font-style: normal;
  font-weight: 500;
  color: rgba(0, 255, 222, .6);
}

.code__line {
  width: 180px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 222, .25), rgba(127, 150, 218, .2), transparent);
  transition: all .5s;
}

.code__label-area--granted .code__label {
  color: rgba(0, 255, 222, .75);
}

.code__label-area--granted .code__lock {
  opacity: 1;
}

.code__label-area--granted .code__line {
  background: linear-gradient(90deg, transparent, rgba(0, 255, 222, .5), rgba(0, 255, 222, .5), transparent);
  box-shadow: 0 0 12px rgba(0, 255, 222, .15);
}

.code__label-area--denied .code__label {
  color: rgba(255, 145, 141, .7);
}

.code__label-area--denied .code__line {
  background: linear-gradient(90deg, transparent, rgba(255, 145, 141, .35), rgba(255, 145, 141, .35), transparent);
}

.code__flaps {
  display: flex;
  gap: clamp(3px, .4vw, 6px);
  align-items: center;
  justify-content: center;
}

.code__flaps--shaking {
  animation: login-shake .45s ease;
}

.code__flap {
  position: relative;
  width: clamp(28px, 8vw, 44px);
  aspect-ratio: 40 / 52;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  background: #1C1C1C;
  border: 1.5px solid transparent;
  border-radius: 5px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 6px rgba(0, 0, 0, .8);
  font-family: var(--font-mono);
  font-size: clamp(16px, 4.4vw, 28px);
  font-weight: 500;
  color: var(--accent);
  transition: border-color .3s, box-shadow .3s;
}

.code__flap::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: .5px;
  background: rgba(0, 0, 0, .6);
}

.code__flap--flipping {
  animation: login-flip .3s ease-in-out;
}

.code__flap--active {
  border-color: rgba(0, 255, 222, .3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 6px rgba(0, 0, 0, .8), 0 0 12px rgba(0, 255, 222, .08);
}

.code__flap--cursor {
  border-bottom: 2px solid rgba(0, 255, 222, .6);
  animation: login-blink 1s step-end infinite;
}

.code__flap--correct {
  border-color: rgba(0, 255, 222, .5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 6px rgba(0, 0, 0, .8), 0 0 20px rgba(0, 255, 222, .15);
}

.code__flap--wrong {
  color: var(--danger);
  border-color: rgba(255, 145, 141, .45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 6px rgba(0, 0, 0, .8), 0 0 14px rgba(255, 145, 141, .1);
}

.code__hint {
  font-size: clamp(12px, .9vw, 14px);
  color: rgba(238, 238, 238, .25);
  transition: opacity .4s;
}

@keyframes login-start-glow {
  0%, 100% {
    box-shadow: 0 0 0 5px rgba(0, 255, 222, .06), 0 0 0 11px rgba(0, 255, 222, .025), 0 0 30px rgba(0, 255, 222, .18), 0 0 65px rgba(0, 255, 222, .06), inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 -3px 6px rgba(0, 0, 0, .7);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(0, 255, 222, .09), 0 0 0 13px rgba(0, 255, 222, .04), 0 0 42px rgba(0, 255, 222, .28), 0 0 80px rgba(0, 255, 222, .09), inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 -3px 6px rgba(0, 0, 0, .7);
  }
}

@keyframes login-fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes login-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes login-logo-in {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: .9; transform: scale(1); }
}

@keyframes login-title-in {
  from { opacity: 0; filter: blur(14px); transform: translateY(18px); clip-path: inset(0 100% 0 0); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); clip-path: inset(0 0 0 0); }
}

@keyframes login-word-in {
  from { opacity: 0; filter: blur(6px); transform: translateY(6px); clip-path: inset(0 100% 0 0); }
  to { opacity: 1; filter: blur(0); transform: translateY(0); clip-path: inset(0 0 0 0); }
}

@keyframes login-pop {
  0% { opacity: 0; transform: scale(.4); }
  60% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes login-aurora-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(70px, 40px) scale(1.12); }
}

@keyframes login-frame-spin {
  to { --login-angle: 360deg; }
}

@keyframes login-sweep {
  0% { opacity: 0; transform: translateX(-520px) skewX(-14deg); }
  20% { opacity: 1; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(2200px) skewX(-14deg); }
}

@keyframes login-flip {
  0% { transform: rotateX(0deg); opacity: 1; }
  45% { transform: rotateX(-90deg); opacity: 0; }
  55% { transform: rotateX(90deg); opacity: 0; }
  100% { transform: rotateX(0deg); opacity: 1; }
}

@keyframes login-blink {
  0%, 100% { border-bottom-color: rgba(0, 255, 222, .6); }
  50% { border-bottom-color: transparent; }
}

@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  90% { transform: translateX(2px); }
}

@media (prefers-reduced-motion: reduce) {
  .login__content,
  .login--leaving .login__content {
    transition: none;
  }

  .code__flap--flipping,
  .code__flaps--shaking {
    animation: none;
  }

  .login__start {
    animation: login-pop .8s ease 5.5s both;
  }

  .login__aurora::before,
  .login__aurora::after,
  .login__frame {
    animation: none;
  }

  .login__sweep {
    display: none;
  }

  @keyframes login-fade-up {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @keyframes login-logo-in {
    from { opacity: 0; }
    to { opacity: .9; }
  }

  @keyframes login-title-in {
    from { opacity: 0; filter: blur(14px); clip-path: inset(0 100% 0 0); }
    to { opacity: 1; filter: blur(0); clip-path: inset(0 0 0 0); }
  }

  @keyframes login-word-in {
    from { opacity: 0; filter: blur(6px); }
    to { opacity: 1; filter: blur(0); }
  }

  @keyframes login-pop {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}
