:root {
  --ink: #f7f5ff;
  --muted: #a9a5ba;
  --muted-strong: #cbc7d8;
  --surface: rgba(16, 14, 27, 0.88);
  --line: rgba(255, 255, 255, 0.1);
  --violet: #a878ff;
  --pink: #ff71ce;
  --cyan: #39d9ff;
  --mint: #50f2b1;
  --yellow: #ffef8e;
  --danger: #ff7a88;
  --shadow: 0 30px 100px rgba(0, 0, 0, 0.52);
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; }

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 13% 18%, rgba(168, 120, 255, 0.14), transparent 28rem),
    radial-gradient(circle at 86% 12%, rgba(80, 242, 177, 0.09), transparent 24rem),
    #07060c;
  font-family: "Cairo", sans-serif;
  font-weight: 400;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  content: "";
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.auth-topbar {
  display: flex;
  width: min(1380px, calc(100% - 64px));
  min-height: 92px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 14px;
  text-decoration: none;
}

.brand-mark {
  background: linear-gradient(90deg, var(--pink), var(--cyan) 38%, var(--mint) 60%, var(--violet) 82%, var(--yellow));
  background-clip: text;
  color: transparent;
  font-size: clamp(2rem, 3vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -0.08em;
  line-height: 1;
  -webkit-text-fill-color: transparent;
}

.brand-note {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-link:hover { color: var(--ink); }
.back-link span { color: var(--pink); }

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(410px, 0.72fr);
  width: min(1280px, calc(100% - 64px));
  min-height: calc(100dvh - 92px);
  margin: 0 auto;
  align-items: center;
  gap: clamp(56px, 8vw, 130px);
  padding: 60px 0 84px;
}

.auth-story { position: relative; padding: 28px 0; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  color: var(--mint);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow::before {
  width: 28px;
  height: 1px;
  background: currentColor;
  content: "";
}

.auth-story h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(3.4rem, 6.2vw, 6.5rem);
  font-weight: 500;
  letter-spacing: -0.065em;
  line-height: 0.94;
}

.auth-story h1 em {
  background: linear-gradient(100deg, var(--pink), var(--violet) 46%, var(--cyan));
  background-clip: text;
  color: transparent;
  font-style: normal;
  -webkit-text-fill-color: transparent;
}

.story-copy {
  max-width: 590px;
  margin: 28px 0 0;
  color: var(--muted-strong);
  font-size: 1rem;
  line-height: 1.7;
}

.ambient-preview {
  position: relative;
  width: min(86%, 560px);
  height: 130px;
  margin-top: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(12, 10, 19, 0.7);
  box-shadow: inset 0 0 70px rgba(168, 120, 255, 0.06);
}

.ambient-preview::after {
  position: absolute;
  right: 18px;
  bottom: 14px;
  color: var(--muted);
  content: "one code · no password";
  font-size: 0.58rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.ambient-preview i {
  position: absolute;
  top: 50%;
  left: 15%;
  border: 1px solid var(--violet);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: drift 8s ease-in-out infinite;
}

.ambient-preview i:nth-child(1) { width: 84px; height: 84px; }
.ambient-preview i:nth-child(2) { width: 54px; height: 54px; border-color: var(--cyan); animation-delay: -2.5s; }
.ambient-preview i:nth-child(3) { width: 24px; height: 24px; border-color: var(--pink); animation-delay: -4s; }

.ambient-preview b {
  position: absolute;
  top: 50%;
  right: 11%;
  left: 31%;
  height: 1px;
  background: linear-gradient(90deg, rgba(168, 120, 255, 0.05), var(--violet), var(--cyan), var(--mint), rgba(80, 242, 177, 0.05));
  box-shadow: 0 0 22px rgba(57, 217, 255, 0.38);
}

.auth-card {
  position: relative;
  width: 100%;
  padding: clamp(28px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.auth-card::before {
  position: absolute;
  top: -1px;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 113, 206, 0.7), rgba(57, 217, 255, 0.7), transparent);
  content: "";
}

.step-label {
  display: inline-flex;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--mint);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 18px 0 8px;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.card-intro {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.6;
}

.auth-form { display: flex; flex-direction: column; gap: 18px; }

.form-field label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted-strong);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.form-field input {
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.86rem;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.form-field input::placeholder { color: #777386; }
.form-field input:hover { border-color: rgba(255, 255, 255, 0.2); }
.form-field input:focus { border-color: rgba(57, 217, 255, 0.72); background: rgba(57, 217, 255, 0.035); box-shadow: 0 0 0 3px rgba(57, 217, 255, 0.08); }
.code-field input { letter-spacing: 0.35em; }

.remember-me {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.68rem;
}

.remember-me input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--mint);
}

.auth-actions { display: flex; flex-direction: column; gap: 10px; }

.btn {
  display: inline-flex;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn-primary { color: #0a0910; background: var(--mint); box-shadow: 0 12px 35px rgba(80, 242, 177, 0.15); }
.btn-primary:hover:not(:disabled) { background: #72f7c2; }
.btn-secondary { border-color: var(--line); color: var(--ink); background: rgba(255, 255, 255, 0.035); }
.btn-secondary:hover:not(:disabled) { border-color: rgba(255, 255, 255, 0.22); background: rgba(255, 255, 255, 0.07); }
.btn:disabled { color: #716d7c; background: rgba(255, 255, 255, 0.045); box-shadow: none; cursor: not-allowed; }

.form-status {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.66rem;
  line-height: 1.5;
}

.form-status.success { color: var(--mint); }
.form-status.error { color: var(--danger); }

.auth-switch {
  margin: 6px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.68rem;
  text-align: center;
}

.auth-switch a { color: var(--ink); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { color: var(--pink); }

.privacy-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px 0 0;
  color: #777386;
  font-size: 0.58rem;
  line-height: 1.5;
}

.privacy-note::before { color: var(--violet); content: "✦"; }

.btn:focus-visible, .back-link:focus-visible, .brand:focus-visible, .auth-switch a:focus-visible, input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

@keyframes drift {
  50% { opacity: 0.55; transform: translate(-50%, -50%) scale(1.12) rotate(14deg); }
}

@media (max-width: 900px) {
  .auth-topbar { width: min(100% - 40px, 720px); }
  .auth-shell { grid-template-columns: 1fr; width: min(100% - 40px, 620px); gap: 36px; padding-top: 54px; }
  .auth-story { padding: 0; text-align: center; }
  .auth-story .eyebrow { justify-content: center; }
  .story-copy { margin-right: auto; margin-left: auto; }
  .ambient-preview { width: min(100%, 510px); margin-right: auto; margin-left: auto; }
}

@media (max-width: 540px) {
  .auth-topbar { width: calc(100% - 28px); min-height: 76px; }
  .brand-note { display: none; }
  .back-link { font-size: 0; }
  .back-link span { font-size: 1rem; }
  .auth-shell { width: calc(100% - 28px); min-height: calc(100dvh - 76px); padding: 40px 0 48px; }
  .auth-story h1 { font-size: clamp(3rem, 16vw, 4.6rem); }
  .story-copy { font-size: 0.88rem; }
  .ambient-preview { height: 108px; margin-top: 34px; }
  .auth-card { padding: 26px 20px; border-radius: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
