:root {
  color-scheme: dark;
  --bg: #070608;
  --surface: #100c0e;
  --surface-2: #181113;
  --ink: #f5f1f1;
  --muted: #b19da0;
  --red: #ff3b4f;
  --red-hot: #ff6b6b;
  --blood: #9f0822;
  --gold: #ffb45c;
  --line: rgba(255, 59, 79, 0.34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
}

.lock-shell {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: clamp(22px, 5vw, 64px);
  isolation: isolate;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 59, 79, 0.16), transparent 30rem),
    radial-gradient(circle at 88% 18%, rgba(255, 180, 92, 0.08), transparent 26rem),
    linear-gradient(135deg, #070608 0%, #120b0d 44%, #050405 100%);
}

.grid-field {
  position: fixed;
  inset: -20%;
  z-index: -3;
  background-image:
    linear-gradient(rgba(255, 36, 76, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 36, 76, 0.12) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(circle at center, black, transparent 68%);
  transform: perspective(760px) rotateX(60deg) translateY(18%);
  animation: gridDrift 12s linear infinite;
}

.scan-beam {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(180deg, transparent, rgba(255, 59, 79, 0.22), rgba(255, 180, 92, 0.08), transparent);
  height: 34%;
  opacity: 0.78;
  animation: scanBeam 5.5s ease-in-out infinite;
}

.lock-shell::before,
.lock-shell::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.lock-shell::before {
  z-index: -1;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.045) 0 1px, transparent 1px 6px);
  mix-blend-mode: screen;
  opacity: 0.35;
}

.lock-shell::after {
  background: radial-gradient(circle at center, transparent 50%, rgba(0, 0, 0, 0.76));
}

.access-stage {
  width: min(1160px, 100%);
  display: grid;
  grid-template-columns: minmax(330px, 1.04fr) minmax(360px, 0.96fr);
  align-items: center;
  gap: clamp(34px, 6vw, 88px);
  animation: stageIn 760ms cubic-bezier(0.2, 0.85, 0.24, 1) both;
}

.lock-array {
  position: relative;
  width: min(50vw, 540px);
  aspect-ratio: 1;
  justify-self: center;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 54px rgba(255, 36, 76, 0.32));
}

.ring {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.ring::before,
.ring::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 22px var(--red);
}

.ring::before {
  top: 14%;
  left: 50%;
}

.ring::after {
  right: 14%;
  bottom: 20%;
}

.ring-one {
  animation: spin 12s linear infinite;
}

.ring-two {
  inset: 11%;
  border-style: dashed;
  animation: spinReverse 18s linear infinite;
}

.ring-three {
  inset: 22%;
  border-color: rgba(255, 91, 111, 0.42);
  animation: pulseRing 2.7s ease-in-out infinite;
}

.unlock-burst {
  position: absolute;
  inset: 29%;
  border-radius: 50%;
  opacity: 0;
  background:
    radial-gradient(circle, rgba(255, 91, 111, 0.52), transparent 38%),
    conic-gradient(from 90deg, transparent, rgba(255, 36, 76, 0.86), transparent, rgba(255, 91, 111, 0.72), transparent);
  filter: blur(1px);
  transform: scale(0.35);
}

.lock-core {
  position: relative;
  width: 42%;
  aspect-ratio: 0.78;
  display: grid;
  place-items: center;
}

.shackle {
  position: absolute;
  top: 0;
  width: 64%;
  height: 48%;
  border: 12px solid rgba(255, 244, 245, 0.94);
  border-bottom: 0;
  border-radius: 80px 80px 0 0;
  box-shadow: inset 0 0 18px rgba(255, 36, 76, 0.34), 0 0 24px rgba(255, 36, 76, 0.3);
  transform-origin: 20% 100%;
}

.lock-body-mark {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 62%;
  border: 1px solid rgba(255, 36, 76, 0.58);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 36, 76, 0.28), transparent),
    rgba(7, 15, 23, 0.92);
  box-shadow: inset 0 0 26px rgba(255, 36, 76, 0.22), 0 0 32px rgba(255, 36, 76, 0.24);
}

.keyline {
  position: absolute;
  bottom: 24%;
  width: 12px;
  height: 40px;
  border-radius: 999px;
  background: linear-gradient(var(--red-hot), var(--red));
  box-shadow: 0 0 24px rgba(255, 36, 76, 0.78);
}

.access-form {
  position: relative;
  min-height: 390px;
  padding: clamp(32px, 4.5vw, 52px);
  border: 1px solid rgba(255, 36, 76, 0.26);
  border-radius: 28px;
  background:
    linear-gradient(145deg, rgba(255, 59, 79, 0.12), rgba(255, 180, 92, 0.035) 42%, rgba(255, 255, 255, 0.025)),
    rgba(16, 12, 14, 0.82);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
}

.access-form::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 59, 79, 0.78), rgba(255, 180, 92, 0.28), transparent);
  opacity: 0.44;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 1px;
  pointer-events: none;
}

h1,
.access-brand {
  min-width: 0;
}

.access-brand {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  margin: 0 0 clamp(28px, 4vw, 42px);
}

.access-logo {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 1px solid rgba(255, 59, 79, 0.44);
  border-radius: 50%;
  background: #080506;
  box-shadow:
    0 0 34px rgba(255, 59, 79, 0.28),
    inset 0 0 0 2px rgba(0, 0, 0, 0.72);
}

.access-logo::after {
  content: "";
  position: absolute;
  inset: -45%;
  background: conic-gradient(from 90deg, transparent, rgba(255, 59, 79, 0.72), transparent 38%);
  animation: spin 8s linear infinite;
  mix-blend-mode: screen;
}

.access-logo img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.12);
}

h1 {
  max-width: 9ch;
  margin: 0;
  color: #fff6f7;
  font-size: clamp(2rem, 3.8vw, 3.45rem);
  line-height: 0.96;
  letter-spacing: 0;
  text-shadow: 0 0 30px rgba(255, 36, 76, 0.22);
}

.auth-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid rgba(255, 59, 79, 0.22);
  border-radius: 16px;
  background: rgba(7, 6, 8, 0.62);
}

.mode-tab {
  height: 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: rgba(245, 241, 241, 0.72);
  background: transparent;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode-tab.active,
.mode-tab:hover {
  color: var(--ink);
  border-color: rgba(255, 59, 79, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 59, 79, 0.18), rgba(255, 255, 255, 0.035)),
    rgba(13, 17, 22, 0.86);
  box-shadow: 0 0 20px rgba(255, 59, 79, 0.12);
}

.access-fields {
  display: grid;
  gap: 12px;
}

.password-shell {
  display: grid;
  gap: 8px;
}

.password-shell span {
  color: rgba(240, 251, 255, 0.72);
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input {
  width: 100%;
  height: 58px;
  border: 1px solid rgba(255, 59, 79, 0.34);
  border-radius: 16px;
  padding: 0 18px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.038), transparent),
    #070608;
  outline: none;
  font: inherit;
  font-size: 1.08rem;
  box-shadow: inset 0 0 0 1px transparent, 0 18px 38px rgba(0, 0, 0, 0.24);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

input:focus {
  border-color: rgba(255, 59, 79, 0.86);
  box-shadow:
    0 0 0 4px rgba(255, 59, 79, 0.12),
    0 0 34px rgba(255, 59, 79, 0.18),
    inset 0 0 0 1px rgba(255, 180, 92, 0.12);
}

.remember-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  color: rgba(240, 251, 255, 0.68);
  font-size: 0.84rem;
  line-height: 1.4;
}

.remember-shell input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--red);
}

.unlock-submit {
  position: relative;
  width: 100%;
  height: 64px;
  margin-top: 16px;
  border: 1px solid rgba(255, 59, 79, 0.42);
  border-radius: 18px;
  color: #fff8f8;
  background:
    linear-gradient(135deg, rgba(255, 59, 79, 0.16), rgba(255, 255, 255, 0.035)),
    rgba(13, 17, 22, 0.88);
  font: inherit;
  font-weight: 950;
  font-size: 1.02rem;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 0 26px rgba(255, 59, 79, 0.14),
    0 18px 44px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: transform 160ms ease, filter 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.unlock-submit:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 59, 79, 0.78);
  background:
    linear-gradient(135deg, rgba(255, 59, 79, 0.25), rgba(255, 255, 255, 0.045)),
    rgba(18, 11, 13, 0.94);
  filter: brightness(1.08);
  box-shadow:
    0 0 36px rgba(255, 59, 79, 0.28),
    0 24px 62px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.unlock-submit:disabled {
  cursor: wait;
  filter: saturate(0.6);
}

.unlock-submit i {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(110deg, transparent 0 35%, rgba(255, 255, 255, 0.46), transparent 65% 100%);
  transform: translateX(-120%);
  animation: buttonSweep 2.4s ease-in-out infinite;
}

.button-glow {
  position: absolute;
  inset: -24px;
  z-index: 0;
  background:
    radial-gradient(circle at 30% 50%, rgba(255, 59, 79, 0.32), transparent 18%),
    radial-gradient(circle at 72% 50%, rgba(255, 0, 61, 0.22), transparent 24%);
  opacity: 0.34;
  animation: buttonGlow 3.2s ease-in-out infinite;
}

.unlock-label,
.unlock-arrow {
  position: relative;
  z-index: 2;
}

.unlock-arrow {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: 10px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 999px;
  background: rgba(7, 6, 8, 0.2);
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition: transform 160ms ease, background 160ms ease;
}

.unlock-submit:hover .unlock-arrow {
  transform: translateX(4px);
  background: rgba(7, 6, 8, 0.34);
}

.access-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: rgba(240, 251, 255, 0.64);
  font-size: 0.92rem;
}

.access-status[data-mode="error"] {
  color: var(--red);
}

.access-status[data-mode="success"] {
  color: var(--red-hot);
}

.denied {
  animation: denyShake 300ms ease;
}

.unlocked .shackle {
  animation: shackleOpen 820ms cubic-bezier(0.17, 0.92, 0.18, 1.08) forwards;
}

.unlocked .lock-body-mark {
  animation: lockBodyRelease 1150ms ease forwards;
}

.unlocked .keyline {
  animation: keylinePop 860ms ease forwards;
}

.unlocked .lock-core {
  animation: lockCoreRelease 1400ms ease forwards;
}

.unlocked .unlock-burst {
  animation: burstRelease 950ms ease-out forwards;
}

.unlocked .ring-one {
  animation: ringRelease 1300ms ease-out forwards;
}

.unlocked .ring-two {
  animation: ringRelease 1400ms ease-out 80ms forwards;
}

.unlocked .ring-three {
  animation: ringRelease 1200ms ease-out 40ms forwards;
}

.unlocked .access-form {
  animation: formUnlock 1550ms ease forwards;
}

.unlocked .grid-field {
  animation: gridUnlock 1500ms ease forwards;
}

.unlocked .scan-beam {
  animation: unlockScan 1050ms ease forwards;
}

.unlocked .access-stage {
  animation: stageOut 1550ms ease forwards;
}

@keyframes stageIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes stageOut {
  0%,
  58% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-26px) scale(1.03);
  }
}

@keyframes gridDrift {
  to {
    background-position: 0 54px, 54px 0;
  }
}

@keyframes scanBeam {
  0%,
  100% {
    transform: translateY(-60%);
    opacity: 0;
  }
  35%,
  65% {
    opacity: 0.78;
  }
  50% {
    transform: translateY(210%);
  }
}

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

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

@keyframes pulseRing {
  0%,
  100% {
    transform: scale(0.98);
    opacity: 0.65;
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
  }
}

@keyframes buttonSweep {
  0%,
  42% {
    transform: translateX(-120%);
  }
  78%,
  100% {
    transform: translateX(120%);
  }
}

@keyframes buttonGlow {
  0%,
  100% {
    transform: translateX(-8%);
    opacity: 0.38;
  }
  50% {
    transform: translateX(8%);
    opacity: 0.62;
  }
}

@keyframes denyShake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-7px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@keyframes unlockLift {
  to {
    transform: translateY(-18px) scale(1.06);
    opacity: 0;
  }
}

@keyframes shackleOpen {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  42% {
    transform: translate(-7%, -14%) rotate(-8deg);
  }
  100% {
    transform: translate(-29%, -32%) rotate(-34deg);
  }
}

@keyframes lockBodyRelease {
  0% {
    box-shadow: inset 0 0 26px rgba(255, 36, 76, 0.22), 0 0 32px rgba(255, 36, 76, 0.24);
  }
  32% {
    border-color: rgba(255, 91, 111, 0.95);
    box-shadow: inset 0 0 38px rgba(255, 36, 76, 0.42), 0 0 64px rgba(255, 36, 76, 0.5);
  }
  100% {
    transform: translateY(8px) scale(0.96);
    opacity: 0.28;
  }
}

@keyframes keylinePop {
  0% {
    transform: scaleY(1);
    opacity: 1;
  }
  55% {
    transform: scaleY(1.35);
    opacity: 1;
  }
  100% {
    transform: scaleY(0) translateY(-22px);
    opacity: 0;
  }
}

@keyframes lockCoreRelease {
  0%,
  68% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-42px) scale(1.14);
    opacity: 0;
  }
}

@keyframes burstRelease {
  0% {
    opacity: 0;
    transform: scale(0.28) rotate(0deg);
  }
  35% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
    transform: scale(2.5) rotate(120deg);
  }
}

@keyframes ringRelease {
  0% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: scale(1.42) rotate(38deg);
  }
}

@keyframes formUnlock {
  0% {
    transform: translateY(0) scale(1);
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }
  40% {
    border-color: rgba(255, 91, 111, 0.78);
    box-shadow: 0 0 84px rgba(255, 36, 76, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  }
  72% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    transform: translateY(-18px) scale(1.02);
    opacity: 0;
  }
}

@keyframes gridUnlock {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
    background-position: 0 180px, 180px 0;
  }
}

@keyframes unlockScan {
  0% {
    transform: translateY(-30%);
    opacity: 0;
  }
  45% {
    opacity: 1;
  }
  100% {
    transform: translateY(145%);
    opacity: 0;
  }
}

@media (max-width: 780px) {
  body {
    overflow: auto;
  }

  .access-stage {
    grid-template-columns: 1fr;
    padding-top: 12px;
    gap: 16px;
  }

  .lock-array {
    width: min(74vw, 320px);
  }

  h1 {
    max-width: 12ch;
    font-size: clamp(2rem, 11vw, 3.15rem);
  }

  .access-form {
    min-height: 320px;
    padding: 28px;
  }

  .access-brand {
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 14px;
    margin-bottom: 24px;
  }

  .access-logo {
    width: 58px;
    height: 58px;
  }

  input,
  .unlock-submit {
    height: 58px;
  }
}
