:root {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
html, body {
  margin: 0;
  min-height: 100%;
  background: #000;
  color: #f5f5f7;
  font-family: "Instrument Sans", "Inter", sans-serif;
  font-weight: 500;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100dvh; overflow-x: hidden; }

.login-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background: #000;
}
.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  will-change: transform;
  mix-blend-mode: screen;
}
.login-blob--a {
  width: 72vw; height: 48vh; left: -12%; bottom: -18%;
  background: radial-gradient(circle, rgba(186, 168, 210, 0.55) 0%, rgba(90, 70, 120, 0.18) 42%, transparent 70%);
  animation: meshA 22s ease-in-out infinite;
}
.login-blob--b {
  width: 58vw; height: 42vh; right: -16%; bottom: -12%;
  background: radial-gradient(circle, rgba(72, 48, 92, 0.7) 0%, rgba(40, 24, 56, 0.25) 50%, transparent 72%);
  animation: meshB 26s ease-in-out infinite;
}
.login-blob--c {
  width: 40vw; height: 36vh; left: 28%; bottom: -8%;
  background: radial-gradient(circle, rgba(214, 204, 224, 0.28) 0%, rgba(120, 96, 148, 0.12) 45%, transparent 70%);
  animation: meshC 18s ease-in-out infinite;
}
.login-blob--d {
  width: 34vw; height: 28vh; left: 8%; bottom: 6%;
  background: radial-gradient(circle, rgba(48, 32, 64, 0.45) 0%, transparent 70%);
  animation: meshD 30s ease-in-out infinite;
}
.login-grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  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='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.9'/%3E%3C/svg%3E");
}
@keyframes meshA { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(8vw,-6vh) scale(1.08); } }
@keyframes meshB { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-6vw,-4vh) scale(1.12); } }
@keyframes meshC { 0%,100% { transform: translate(0,0); } 50% { transform: translate(-4vw,-9vh); } }
@keyframes meshD { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(5vw,-3vh) scale(0.94); } }

.login-wrap {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}
.login-card {
  width: min(420px, 100%);
  padding: 36px 30px 26px;
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  animation: rise 0.7s var(--ease) both;
  transition: opacity 0.26s var(--ease), transform 0.26s var(--ease);
}
.login-card.is-leaving { opacity: 0; transform: translateY(-8px) scale(0.99); }
.login-card.shake { animation: shake 0.42s var(--ease); }
.login-brand { text-align: left; margin-bottom: 22px; }
.login-mark {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  border: 0.5px solid rgba(255,255,255,0.12);
  margin-bottom: 14px;
}
.login-mark svg { width: 18px; height: 18px; stroke: #f5f5f7; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-brand h1 {
  margin: 0;
  font-family: Fraunces, serif;
  font-weight: 500;
  letter-spacing: -0.03em;
  font-size: 2rem;
}
.login-sub {
  margin: 6px 0 0;
  font-family: Fraunces, serif;
  font-style: italic;
  font-weight: 400;
  color: #8d8496;
  font-size: 0.95rem;
}

.login-error {
  display: none;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 0.5px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.05);
  color: #e5e5e5;
  font-size: 0.86rem;
  line-height: 1.4;
}
.login-error.visible { display: flex; animation: rise 0.36s var(--ease) both; }
.login-error svg { flex-shrink: 0; width: 16px; height: 16px; margin-top: 1px; stroke: #aeaeb2; fill: none; stroke-width: 1.8; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6e6e73;
}
.field-input-wrap { position: relative; display: flex; align-items: center; }
.field-icon {
  position: absolute;
  left: 14px;
  width: 16px; height: 16px;
  stroke: #6e6e73;
  fill: none;
  stroke-width: 1.7;
  pointer-events: none;
  transition: stroke 0.2s ease;
}
.field input {
  width: 100%;
  height: 50px;
  padding: 0 46px 0 42px;
  border-radius: 14px;
  border: 0.5px solid rgba(255,255,255,0.1);
  background: #0a0a0a;
  color: #f5f5f7;
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.field input::placeholder { color: #525252; }
.field input:focus {
  border-color: rgba(255,255,255,0.28);
  background: #0f0f0f;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}
.field-input-wrap:focus-within .field-icon { stroke: #d4d4d4; }
.toggle-pwd {
  position: absolute;
  right: 8px;
  width: 34px; height: 34px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: #6e6e73;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.toggle-pwd:hover { color: #d4d4d4; background: rgba(255,255,255,0.05); }
.toggle-pwd.is-on { color: #f5f5f7; }
.toggle-pwd svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.7; }

.login-submit {
  width: 100%;
  margin-top: 8px;
  min-height: 52px;
  border-radius: 999px;
  border: 0.5px solid rgba(255,255,255,0.14);
  color: #f5f5f7;
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 0.5px 0 rgba(255,255,255,0.12);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  font: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.16s ease, border-color 0.2s ease;
}
.login-submit:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.22); }
.login-submit:active { transform: scale(0.985); }
.login-submit:disabled { opacity: 0.6; cursor: default; transform: none; }
.login-submit-inner { display: inline-flex; align-items: center; gap: 10px; }
.login-submit-icon { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.28s var(--ease); }
.login-submit:hover .login-submit-icon { transform: translateX(3px); }
.login-submit.loading .login-submit-icon { animation: nudge 0.9s ease-in-out infinite; }

.login-foot {
  margin: 18px 0 0;
  color: #6e6e73;
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: center;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%,100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes nudge { 0%,100% { transform: translateX(0); } 50% { transform: translateX(5px); } }

@media (max-width: 520px) {
  .login-card { padding: 30px 22px 22px; border-radius: 22px; }
  .login-brand h1 { font-size: 1.8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .login-blob, .login-card, .login-error.visible, .login-submit.loading .login-submit-icon { animation: none !important; }
  .login-card.shake { animation: none; }
}
