<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Auth Forms with Hidden Hamburger</title>
    <style>
        body {
            margin: 0;
            font-family: Arial, sans-serif;
        }
        .hamburger {
            position: fixed;
            top: 20px;
            right: 20px;
            width: 30px;
            height: 30px;
            cursor: pointer;
            z-index: 100;
            transition: opacity 0.3s ease;
        }
        .hamburger span {
            display: block;
            width: 100%;
            height: 2px;
            background-color: #333;
            margin: 6px 0;
            transition: 0.4s;
        }
        .menu, .auth-form, .reg-form {
            position: fixed;
            top: 0;
            right: -300px;
            width: 300px;
            height: 100vh;
            background-color: #f1f1f1;
            transition: 0.4s;
            padding-top: 60px;
            box-sizing: border-box;
        }
        .menu.active, .auth-form.active, .reg-form.active {
            right: 0;
        }
        .menu ul {
            list-style-type: none;
            padding: 0;
        }
        .menu ul li {
            padding: 10px 20px;
        }
        .menu ul li a, .menu ul li button {
            color: #333;
            text-decoration: none;
            background: none;
            border: none;
            font-size: 16px;
            cursor: pointer;
            padding: 0;
        }
        .hamburger.active span:nth-child(1) {
            transform: rotate(-45deg) translate(-5px, 6px);
        }
        .hamburger.active span:nth-child(2) {
            opacity: 0;
        }
        .hamburger.active span:nth-child(3) {
            transform: rotate(45deg) translate(-5px, -6px);
        }
        .close {
            position: absolute;
            top: 20px;
            right: 20px;
            font-size: 24px;
            cursor: pointer;
        }
        form {
            display: flex;
            flex-direction: column;
            padding: 20px;
        }
        input, button[type="submit"] {
            margin-bottom: 10px;
            padding: 5px;
        }
        .hidden {
            opacity: 0;
            pointer-events: none;
        }
    </style>
</head>
<body>
    <div class="hamburger">
        <span></span>
        <span></span>
        <span></span>
    </div>
    <nav class="menu">
        <ul>
            <li><a href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li><a href="#">Services</a></li>
            <li><a href="#">Contact</a></li>
            <li><button id="auth-btn">Authorization</button></li>
            <li><button id="reg-btn">Registration</button></li>
        </ul>
    </nav>

    <div class="auth-form">
        <span class="close">&times;</span>
        <form>
            <h2>Authorization</h2>
            <input type="email" placeholder="Email" required>
            <input type="password" placeholder="Password" required>
            <button type="submit">Log In</button>
        </form>
    </div>

    <div class="reg-form">
        <span class="close">&times;</span>
        <form>
            <h2>Registration</h2>
            <input type="text" placeholder="Name" required>
            <input type="email" placeholder="Email" required>
            <input type="password" placeholder="Password" required>
            <input type="password" placeholder="Confirm Password" required>
            <button type="submit">Register</button>
        </form>
    </div>

    <script>
        const hamburger = document.querySelector('.hamburger');
        const menu = document.querySelector('.menu');
        const authForm = document.querySelector('.auth-form');
        const regForm = document.querySelector('.reg-form');
        const authBtn = document.getElementById('auth-btn');
        const regBtn = document.getElementById('reg-btn');
        const closeBtns = document.querySelectorAll('.close');

        function closeAllForms() {
            authForm.classList.remove('active');
            regForm.classList.remove('active');
            hamburger.classList.remove('hidden');
        }

        function closeMenu() {
            menu.classList.remove('active');
            hamburger.classList.remove('active');
        }

        function openForm(form) {
            closeMenu();
            closeAllForms();
            form.classList.add('active');
            hamburger.classList.add('hidden');
        }

        hamburger.addEventListener('click', () => {
            hamburger.classList.toggle('active');
            menu.classList.toggle('active');
            closeAllForms();
        });

        authBtn.addEventListener('click', () => openForm(authForm));
        regBtn.addEventListener('click', () => openForm(regForm));

        closeBtns.forEach(btn => {
            btn.addEventListener('click', (e) => {
                e.target.closest('.auth-form, .reg-form').classList.remove('active');
                hamburger.classList.remove('hidden');
            });
        });
    </script>
</body>
</html> OK, but when closing the forms of authorization and registration should throw to the primary menu with buttons home authorization and registration and so on, but not completely close everything