.auth-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
}

.auth-modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f1419 100%);
    border: 4px solid var(--color-purple);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.6),
                0 0 80px rgba(6, 182, 212, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: min(90vh, 90dvh);
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.4s ease;
    -webkit-overflow-scrolling: touch;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.auth-modal::-webkit-scrollbar {
    width: 12px;
}

.auth-modal::-webkit-scrollbar-track {
    background: var(--color-dark);
    border-left: 2px solid var(--color-purple);
}

.auth-modal::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-purple), var(--color-pink));
    border-radius: 0;
}

.auth-modal::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, var(--color-cyan), var(--color-blue));
}

.auth-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(139, 92, 246, 0.2);
    border: 3px solid var(--color-purple);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-purple);
    font-weight: normal;
    font-family: Arial, sans-serif;
    line-height: 1;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    user-select: none;
}

.auth-modal-close:hover {
    background: rgba(139, 92, 246, 0.4);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
    color: var(--color-cyan);
}

.auth-modal-close:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.auth-modal-header {
    padding: 40px 40px 30px;
    text-align: center;
    border-bottom: 4px solid var(--color-purple);
}

.auth-modal-title {
    font-size: 14px;
    font-family: 'Press Start 2P', monospace;
    background: linear-gradient(135deg, var(--color-cyan), var(--color-pink), var(--color-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 25px;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.8;
}

.auth-tabs {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.auth-tab {
    padding: 14px 32px;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 3px solid var(--color-purple);
    background: rgba(139, 92, 246, 0.2);
    color: var(--color-purple);
    text-transform: uppercase;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.auth-tab.active {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--color-cyan);
    color: var(--color-cyan);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.6);
}

.auth-tab:hover:not(.active) {
    background: rgba(139, 92, 246, 0.4);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.auth-tab:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.auth-modal-body {
    padding: 30px 40px 40px;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.oauth-section {
    margin-bottom: 30px;
}

.oauth-title {
    font-size: 10px;
    font-family: 'Press Start 2P', monospace;
    color: var(--color-light);
    text-align: center;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.oauth-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.oauth-button {
    width: 70px;
    height: 70px;
    border: 3px solid;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
    background: transparent;
    text-decoration: none;
    color: inherit;
}

.oauth-button:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.5);
}

.oauth-button:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.oauth-button.yandex {
    border-color: var(--color-purple);
}

.oauth-button.yandex:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--color-cyan);
}

.oauth-button.google {
    border-color: var(--color-purple);
}

.oauth-button.google:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--color-cyan);
}

.oauth-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.oauth-button:hover .oauth-icon {
    transform: scale(1.1);
}

.oauth-button:disabled .oauth-icon {
    opacity: 0.6;
}

.oauth-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.oauth-button:disabled:hover {
    transform: none;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.4);
    background: transparent;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.auth-divider-line {
    flex: 1;
    height: 2px;
    background: var(--color-border);
}

.auth-divider-text {
    font-size: 10px;
    font-family: 'Press Start 2P', monospace;
    color: var(--color-gray);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.form-group {
    margin-bottom: 25px;
}

.form-label {
    display: block;
    font-size: 10px;
    font-family: 'Press Start 2P', monospace;
    color: var(--color-cyan);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-input {
    width: 100%;
    padding: 15px 20px;
    background: var(--color-dark-input);
    border: 3px solid var(--color-purple);
    color: var(--color-light);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 16px;
    transition: all 0.3s ease;
    outline: none;
    line-height: 1.5;
}

.form-input:focus {
    border-color: var(--color-cyan);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.4);
}

.form-input::placeholder {
    color: var(--color-gray);
    opacity: 0.6;
}

.form-submit {
    width: 100%;
    padding: 0 28px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-pink), var(--color-purple));
    color: white;
    border: none;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
    text-transform: uppercase;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
}

.form-submit:hover {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.form-submit:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.form-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.forgot-password {
    display: block;
    text-align: center;
    margin-top: 20px;
    font-size: 9px;
    font-family: 'Press Start 2P', monospace;
    color: var(--color-gray);
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.forgot-password:hover {
    color: var(--color-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.auth-message {
    padding: 16px 20px;
    margin-bottom: 25px;
    font-size: 9px;
    font-family: 'Press Start 2P', monospace;
    border: 3px solid;
    text-align: center;
    display: none;
    line-height: 1.6;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.auth-message.success {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22C55E;
    color: #22C55E;
}

.auth-message.error {
    background: rgba(239, 68, 68, 0.15);
    border-color: #EF4444;
    color: #EF4444;
}

.auth-message.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

@media (max-width: 768px) {
    .auth-modal {
        max-width: 95%;
    }

    .auth-modal-header {
        padding: 30px 25px 20px;
    }

    .auth-modal-title {
        font-size: 11px;
    }

    .auth-tab {
        font-size: 8px;
        padding: 12px 20px;
    }

    .auth-modal-body {
        padding: 25px;
    }

    .oauth-button {
        width: 60px;
        height: 60px;
    }

    .oauth-icon {
        width: 36px;
        height: 36px;
    }

    .form-label {
        font-size: 9px;
    }

    .form-input {
        font-size: 16px;
        padding: 14px 16px;
    }

    .form-submit {
        font-size: 9px;
        padding: 0 20px;
        height: 50px;
    }

    .forgot-password {
        font-size: 8px;
    }
}

.reset-back {
    margin-bottom: 25px;
}

.reset-back-btn {
    background: transparent;
    border: none;
    color: var(--color-gray);
    font-size: 9px;
    font-family: 'Press Start 2P', monospace;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 10px 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.reset-back-btn:hover {
    color: var(--color-cyan);
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.5);
}

.reset-info {
    background: rgba(6, 182, 212, 0.1);
    border: 2px solid var(--color-cyan);
    padding: 15px;
    margin-bottom: 25px;
    text-align: center;
}

.reset-info-text {
    font-size: 9px;
    font-family: 'Press Start 2P', monospace;
    color: var(--color-cyan);
    line-height: 1.6;
    margin: 0;
}

.reset-info-text span {
    color: var(--color-light);
    display: block;
    margin-top: 8px;
}

.code-input {
    text-align: center;
    font-size: 24px !important;
    letter-spacing: 8px;
    font-weight: bold;
    font-family: 'Courier New', monospace !important;
}

.resend-code-btn {
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: 3px solid var(--color-purple);
    color: var(--color-purple);
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    text-transform: uppercase;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
}

.resend-code-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--color-cyan);
    color: var(--color-cyan);
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.4);
}

.resend-code-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.resend-code-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-modal-overlay.reset-mode .auth-modal-close {
    pointer-events: auto;
}

.auth-modal-overlay.reset-mode {
    pointer-events: auto;
}

@media (max-width: 480px) {
    .auth-modal-title {
        font-size: 9px;
        line-height: 1.6;
    }

    .auth-tab {
        font-size: 7px;
        padding: 10px 16px;
    }

    .oauth-button {
        width: 55px;
        height: 55px;
    }

    .oauth-icon {
        width: 32px;
        height: 32px;
    }

    .form-label {
        font-size: 8px;
    }

    .form-input {
        font-size: 16px;
        padding: 12px 14px;
    }

    .form-submit {
        font-size: 8px;
        padding: 0 16px;
        height: 46px;
    }

    .forgot-password {
        font-size: 7px;
    }

    .auth-message {
        font-size: 8px;
    }

    .reset-back-btn {
        font-size: 8px;
    }

    .reset-info-text {
        font-size: 8px;
    }

    .code-input {
        font-size: 20px !important;
        letter-spacing: 6px;
    }

    .resend-code-btn {
        font-size: 8px;
    }
}
